[TriZPUG] identity crisis

Laura Tateosian lgtateos at ncsu.edu
Wed Sep 4 23:10:45 CEST 2013


I'd like to get the path of the current file, so that I can append the 
sys.path and then import user-defined modules based on relative paths.

sys.argv[0] can do this. But sometimes it returns just the file base 
name or an empty string, depending on how the script is run. The same 
goes for __file__

Is there a simple reliable approach for determining the full path file 
name of the script I'm inside?

Thanks,
Laura


More information about the TriZPUG mailing list