GEEK: How to tell where your script is located in Python

Suppose you’re executing a python script in the debugger, and you want to find out where the script you’re executing is located. This should do the trick:

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

Post a Comment

You must be logged in to post a comment.