i have python 3 project wanted release. here structure:
readme.rst setup.cfg setup.py projectname ├── __init__.py ├── __main__.py ├── file1.py └── file2.py
in setup.py have usual info (name, description etc.) , 2 relevant lines are:
packages=find_packages(), entry_points={ 'console_scripts': [ 'project-name=projectname.__main__:main', ], },
in __main__.py
, following imports:
from file1 import file2 import b
my project works fine when running __main__.py
in terminal normally:
python3 __main__.py
however, after running setup.py:
sudo python3 setup.py install
and running:
project-name
i following error:
importerror: no module named 'file1'
what strange if explicit relative imports instead:
from .file1 import .file2 import b
this work installed package not when running __main__.py
in terminal following error:
systemerror: parent module '' not loaded, cannot perform relative import
i lost here, can shed light? have been reading on imports in python 3 , nothing has helped me yet. appreciated. please let me know if addition information required. thanks!