Created
October 17, 2012 08:33
-
-
Save npinto/3904425 to your computer and use it in GitHub Desktop.
How to reliably open a file in the same directory as a Python 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 | |
from os import path | |
__location__ = path.realpath(path.join(os.getcwd(), path.dirname(__file__))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment