uhuuyouneverknow
uhuuyouneverknow

Reputation: 433

How to create .exe from python script with modules and dependent files

I want to create an executable .exe file from my python script. I have tried many tutorials and ways explained on the web to do this. I have tried py2exe pyInstaller but I couldnt create a working executable file. I'm using Enthought Canopy as my programming environment. The modules imported in the code are as follows:

import Tkinter as tk
from Tkinter import Text
from PIL import ImageTk, Image
import pyttsx
import pickle

I'm using an object from a file that I have created by pickle so I need them too. Lets say I have 2 files named a.fil b.fil

When I run the .exe file it instantly show a command prompt and closes it directly.

Traceback (most recent call last):
    File "code.py", line 4 in <module>
    File "Tkinter.pyc", line 38 in <module>
    File "FixTk.pyc", line 65 in <module>
    File "_tkinter.pyc", line 12 in <module>
    File "_tkinter.pyc", line 10 in _load
Import Error: DLL load failed : %1 is not a valid win32 application

Upvotes: 0

Views: 3997

Answers (2)

Dukk
Dukk

Reputation: 114

Try changing the settings for py2exe. Or, read the manual. py2exe can't copy all DLLs because, like Alex Ivanov said:

py2exe will never copy all DLLs because it's illegal since the window stuff is the Intellectual Property of Microsoft and copying it violates the copyright law. If you need DLLs copy them yourself

Upvotes: 0

Alex Ivanov
Alex Ivanov

Reputation: 823

There's only py2exe. Just read the manual. py2exe will never copy all DLLs because it's illegal since the window stuff is the Intellectual Property of Microsoft and copying it violates the copyright law. If you need DLLs copy them yourself. If you don't know which ones use Dependency Walker.

Upvotes: 1

Related Questions