I changed optimize to 0 in my setup.py file and it fixed the not being able to import .pyc.

When it compiles the .exe, it bundles our main application as well as the pre_loader.

The pre_loader downloads the main application file (programmanager.pyc) and then imports and it and initates run on it. If we compile the preloader without the .py file for the main application, it fails at running the application after it imports it.

Is there a way that we can remove the .py file when we run our preloader, so the only existing version is the one outside of the compiled .exe?

On Mon, Aug 8, 2011 at 9:21 PM, Mark Hammond <skippy.hammond@gmail.com> wrote:
On 9/08/2011 10:56 AM, Adam Estes wrote:
I am unable to import the .pyc files because py2exe is putting
everything in .pyo form.

That can't be correct - py2exe is also creating .pyo files for me in that test - but I can import that module 't' when just the .pyc, or just the .pyo exist.

Also, I don't understand why py2exe is looking at your "independent" modules at all - isn't the entire point to have py2exe ignore them and just to import them "normally" at runtime?  In that case, I don't understand why you are asking how to get py2exe to create .pyc or .pyo versions of those modules - it should not be touching them.

I suggest you take the same sample I did and show us the absolute minimum that demonstrates your problem.