Function for the path of the script?

Peter Cacioppi peter.cacioppi at gmail.com
Sat Oct 26 22:23:43 EDT 2013


Am I the only one who finds this function super useful?

def _code_file() :
    return os.path.abspath(inspect.getsourcefile(_code_file))


I've got one in every script. It's the only one I have to copy around. For my workflow ... so handy.

I've got os.path.dirname aliased to dn, so its dn(_code_file()) that I find myself reaching for fairly often...



More information about the Python-list mailing list