Accessing A File Relatively In Python If You Do Not Know Your Starting Point?
Hey. I've got a project in Python, whose directory layout is the following: root |-bin |-conf |-[project] Python files in [project] need to be able to read configuration dat
Solution 1:
Instead of:
path = os.path.abspath(__file__)[:-8]
use:
path = os.path.dirname(os.path.abspath(__file__))
See the docs here.
Post a Comment for "Accessing A File Relatively In Python If You Do Not Know Your Starting Point?"