I am trying to setup my python application in a more standard way. In my
research, the general recommendation seems to be that if my application is
called projectgendocs, here is an acceptable structure:

ProjectParent
|-- bin/
|  |-- projectgendocs.py
|
|-- projectgendocs
|  |-- unittest
|  |  |-- __init__.py
|  |  |-- test_main.py
|  |
|  |-- __init__.py
|  |-- main.py
|
|-- setup.py
|-- README


It is my understanding that ProjectParent would be added to the PYTHONPATH
so the projectgendocs project could be discovered for importing. The
problem I am encountering is that when the bin/projectgendocs.py is run, it
breaks the imports in the ProjectParent/projectgendocs files that have

import projectgendocs.somefile.py

I discovered this is due to the fact that the bin/projectgendocs is
discovered in the search for a package called projectgendocs because the
bin directory is added to the search path. I verified this by renaming the
bin/projectgendocs.py file to something different. So, my question is this:
How can a python application (the file installed in the bin folder) have
the same name as its corresponding python project and not break the
absolute imports? Or is the only way to do this is by using relative
imports?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to