Created
October 18, 2015 14:08
-
-
Save justb4/f45de41856f3610e2869 to your computer and use it in GitHub Desktop.
Python: determine various dirs within executing script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os,sys | |
print "CWD: ",os.getcwd() | |
print "Script: ",sys.argv[0] | |
print ".EXE: ",os.path.dirname(sys.executable) | |
print "Script dir: ", os.path.realpath(os.path.dirname(sys.argv[0])) | |
pathname, scriptname = os.path.split(sys.argv[0]) | |
print "Relative script dir: ",pathname | |
print "Script dir: ", os.path.abspath(pathname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment