Reputation: 147
I have a python script that works fine on my computer (Python 2.7 32 bit installed). It has the following imports :
import mechanize from bs4 import BeautifulSoup from Tkinter import * import json import webbrowser
I wanted to distribute this to others so I found that we can create exe files using py2exe. I wrote a script like this:
from distutils.core import setup import py2exe setup(console=['notification.py'], options = {'py2exe' : { 'packages' : ['bs4', 'mechanize','Tkinter', 'json', 'webbrowser'] }})
This works fine on my computer but when I run it on Windows XP, I get this error -
Traceback (most recent call last): File "notification.py", line 3, in File "Tkinter.pyc", line 38, in File "FixTk.pyc", line 65, in File "_tkinter.pyc", line 12, in File "_tkinter.pyc", line 10, in __load ImportError: DLL load failed: %1 is not a valid Win32 application.
I tried searching other threads but found none that has the same problem. So please help me fix this issue.
Upvotes: 0
Views: 634
Reputation: 147
Well, I had installed both versions of Python 32 bit and 64 bit in my machine. When I was making it a stand alone probably some dlls were copied from the wrong library. So I completely uninstalled both versions and then installed 32 bit and it worked fine.
Upvotes: 1
Reputation: 462
Maybe Tinkiter is a 64 bit version GUI, while Windows XP version you run it is 32bit.
Check it out and tell us if that's the case.
Reason I assume this is the line:
ImportError: DLL load failed: %1 is not a valid Win32 application.
combined with the fact that Tinkiter is 64 bit.
Python can be 32 bit. Works on both Operating Systems, 32 and 64 bit ones. But Tinkiter is a GUI, something different than the language. So Including a 64bit add-on, into a 32bit application... can cause some trouble. :)
Suggestion: You can start by making the app work in console interface if possible. Then you can use another GUI that can run in 32 bit.
For instance, you can get a 32bit version of THIS
Edit: Added a suggeston.
Upvotes: 1