Get Current Script Path in Python

Posted on August 26, 2019 at 12:15 pm

Snippet to get current script directory in Python:

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

It will output the current Python script path, i.e:

/path/to/python/script

Receive updates via email

Other Posts

Updated Posts