问题
When I try to run an app in Appcelerator (3.1.x) on the built-in Android emulator I'm getting a Python error like this:
Traceback (most recent call last):
File "C:\Users\Donny\AppData\Roaming\Titanium\mobilesdk\win32\3.1.3.GA\android\fastdev.py", line 10, in <module>
import urllib, threading
File "C:\csvn\Python25\lib\urllib.py", line 26, in <module>
import socket
File "C:\csvn\Python25\lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
I'm not proficient in Python, but what I understand from this question, this question and this one, is that I have a 32 bit version of Python trying to call a 64 bit DLL, right? I'm running on a 64 bit version of Windows 7, so this would make sense. If this is the case, how do I go about fixing this? Would I have to modify something in Appcelerator to use the 64 bit version of Python or possibly direct it to a 32 bit DLL instead?
回答1:
It seems to be using this script to locate your system's Python. The script seems to be picking up a Python installation in C:\csvn\Python25
which apparently comes with Collabnet's SVN for Windows and is in all likelihood not a full Python installation.
You should just install a standard 64-bit Python from python.org. That little batch script seems to suggest they support Python 2.5 and 2.6, though 2.7 would likely work too. Maybe to be on the safe side start with 2.6: http://www.python.org/download/releases/2.6.6/
Just install to the normal default installation path of C:\Python26
and make sure that path is early on your %PATH%
environment variable.
回答2:
I had that same issue with a different script.
I had both 32 and 64 bit python installed on my computer and when I just typed 'python' into it, it would run the 32 bit version.
I reinstalled my 64 bit version and then it picked that one when I just typed python.
回答3:
this seems like a string format error.
i guess, code should be something like this ctype.WinDll('%1' % dllPath), but string not format as expected, so ctype treat '%1' like a dll path.
just guess.
来源:https://stackoverflow.com/questions/20584889/dll-load-failed-1-is-not-a-valid-win32-application-appcelerator