For a Python3 project of my own, I'm trying to follow the file system structure described by Jean-Paul Calderone (credits for the original document) :
MyProject/
|-- bin/
| |-- myproject
|
|-- myproject/
| |-- test/
| | |-- __init__.py
| | |-- test_main.py
| |
| |-- __init__.py
| |-- main.py
|
|-- setup.py
|-- README
My project isn't mature but the tests are ok : a call to nosetests
run the different parts of the code as expected.
So now, I'm trying to produce an executable, an "external entry point" to my code. I'm struggling with the content of the executable (bin/myproject); I read in Jean-Paul Calderone blog :
Don't give them a .py extension, even if they are Python source files. Don't put any code in them except an import of and call to a main function defined somewhere else in your projects.
So, I tried to fill the executable with the following lines...
from ..myproject.main import main
main()
... but being in the Project
directory and calling my program with bin/myproject
raises an import error :
SystemError: Parent module '' not loaded, cannot perform relative import
I can't go further : any idea to help me ?