Skip to content

Latest commit

 

History

History
8 lines (5 loc) · 375 Bytes

get-directory-of-current-script.md

File metadata and controls

8 lines (5 loc) · 375 Bytes

Get directory of current script (2016-06-11)

Can be done by getting the directory part of __file__ or sys.argv[0], in case the former is not available:

os.path.dirname(os.path.realpath(__file__))

os.path.dirname(os.path.realpath(sys.argv[0]))

Thank you, Stack Overflow!