I am working on porting a python2 project to python3 while keeping the compatibility with python2. I started fixing small things: indentation, print calls, some imports using six etc.
The Makefile creates a zip archive with the python header preppended, and so it generates a pyz file. In the root directory of this archive there is a __main__.py file.
When I run the archive with python3, it gives the following error:
# python3 proj.pyz
/usr/bin/python3: can't find '__main__' module in 'proj.pyz'
An interesting thing happens if I run the __main__.py file, and not the archive, it works just the same as it works on python2. Also, if I run the pyz with python2 it also works. Any idea why this happens?
FIXED:
After some more debugging, found out that there was, inside the package a runpy.py (for python 2) script. Because of this, the python interpreter was prioritizing this one and not the one on the machine. I removed it and now it works fine.
Note: I leave the question here, because maybe someone would need this.