I have a project that is structured like this (cut down a lot to give the gist)...
State_Editor/
bin/
state_editor/
__init__.py
main.py
features/
__init__.py
# .py files
io/
__init__.py
# .py files
# etc.
You get the idea. Now say for example that foobar.py
in features
did this... from state_editor.io.fileop import subInPath
. Obviously State_Editor
needs to be in the path.
I've read about sys.path.append and path configuration files, but I'm not sure how to accomplish what I need to accomplish, or what the most pythonic way to do it is.
The biggest problem is I don't know how to specify "one directory up". Obviously this is ..
, but I'm not sure how to avoid this being interpreted as a string literal. For example if I do sys.path.append('../')
it will literally append ../
to the path.
So my question is, what is the most "pythonic" way to accomplish this?