Question

I have the following project structure:

Project
  - GUI
    - ...Modules
  - Data
    - Database
      - ...Modules
    - Files
      - ...Modules
  - Utilities
    - ...Modules

And I am trying to do some imports over package borders, for example:

in the file(Module) Project.Database.dbdriver I try to import Project.Utilities.Conversions. If I use a fully specified import like import Project.Utilities.Conversions this fails, it works with import Utilities.Conversions, i.e. I can not specify more off the path than those part that differ. However I would like to use fully specified paths, one reason beeing that pydev in eclipse likes them better (otherwise it shows me an error), the second reason is I find it confusing not to do so.

I have stumbled over this but think it is wrong/not needed here How do I create a namespace package in Python?

Question: how can I use fully specified includes when crossing subbranches in a package structure?

Was it helpful?

Solution

The fully specified import failed because the current working directory of python(or jython) was set to Project. you can:

add the parent directory of Project to your python lib

import sys
sys.path.append('/parent/of/project')

or just change the working directory of jython to the parent of Project in the debug settings.(I don't know how to do it because I don't use pydev.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top