DLLs loading in interpreter but not with direct run on Windows
bigboss1964 at gmail.com
Sat Apr 24 18:32:32 CEST 2010
On Apr 23, 4:47 pm, JTimoty <jtim... at gmail.com> wrote:
> I've got a weird problem, apparently related to the way python
> searches for DLLs on Windows.
> I compiled PyQt4 (no errors) but scripts that use it fail with "DLL
> load failed: Invalid access to memory location."
> If I play with loading the modules inside the interpreter, I see no
> Even more, if I use IDLE, running scripts fails. However, if I _first_
> type "from PyQt4 import QtGui" in the python shell, the script
> executes without problems.
I have the batch file that sets up my python 2 and python 3 sessions,
each append the site-packages\PyQt4 directory to my %Path%, so that
Windows will definitely be able to see the (Py)Qt DLL files located
If you take a look at the PyQt4 package, __init__.py is just a stub.
I'm not familiar with SIP, so I don't know what pyqtconfig.py does.
Everything that you import however, is basically the name of a .pyd
and .dll file there. E.g. from pyQt4 import QtGui = there is a
QtGui.pyd and QtGui.dll module.
The .pyd file is what you're really importing, but I don't recall the
relationship to the dll files clumped around it. You can probably find
it in the python or windows manuals somewhere.
> What is the difference between these two cases? How is loading dlls
> different in ( $> python script.py ) and just ( $> python )?
Example from my system:
> vim test.py
> python test.py
['My CWD', 'C:\\WINDOWS\\system32\\python26.zip', 'C:\\Dev
6\\lib\\lib-tk', 'C:\\DevFiles\\Languages\\Python\\26', 'C:\\DevFiles\
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
['', 'C:\\WINDOWS\\system32\\python26.zip', 'C:\\DevFiles\\Languages\
s', 'C:\\DevFiles\\Languages\\Python\\26\\lib', 'C:\\DevFiles\
I also note that there is no python26.zip file in %SystemRoot%
\system32, just DLL files corresponding to each version of Python I
More information about the Python-list