filesystems - Pythonic way to modify python path relative to current directory -


I have a project that is structured in this way (very little to give to the summary) ...

  State_Editor / bin / state_editor/ __init__.py main.py attributes / __init__.py # .i files io / __init__.py # .i files # etc  

you get the idea. Now for example, say features in foobar.py did this ... from state_editor.io.fileop import subInpath . Obviously state_editor should be on the way

I've read about sys.path.append and path configuration files, but I'm not sure what to do to fulfill me What is the most python way to do this, or is it necessary?

The biggest problem is that I do not know how to specify a "directory up", obviously it is .. , but I'm not sure how to do it with a string To avoid being defined as a literal example, if I do sys.path.append ('../')] / code> then it's literally in the path ../ .

So my question is, what is the most "dragon" method to accomplish this?

According to this question, you have 2 key points (modules containing imported, state_editor.features.foobar ) is required. Therefore: ..io.fileop import sub-paths

to

  complete document: 


Comments