A more specific query ...

G

Gib Bogle

How can I interrogate Python to find out where it is looking to find the PyQt4
DLLs in a Windows installation? Secondarily, how is this search path set?
 
C

Chris Rebert

How can I interrogate Python to find out where it is looking to find the
PyQt4 DLLs in a Windows installation?

import sys
print(sys.path)

Cheers,
Chris
 
G

Gib Bogle

The point of my question was that sys.path is clearly not being used in this
case. When I start Python sys.path includes D:\python26\lib\site-packages which
seems to be the Python default. Using sys.path.append I have tried adding both
D:\python26\lib\site-packages\PyQt4 and D:\python26\lib\site-packages\PyQt4\bin
to the path, but this has no effect. So far the only way I've found to make the
PyQt4 DLLs visible to Python is by copying them from PyQt4\bin into PyQt4.

I've tried adding stuff to the Windows PATH, but that has no effect.

Gib
 
G

Gib Bogle

The PyQt4 problem results from having copies of the Qt DLLs in directories that
are in the PATH, as Doug Bell discovered. In my case I have two programs that
use Qt, AMD CodeAnalyst and Matlab. If I rename BOTH these directories I can
import the PyQt4 modules.

Since this behaviour did not occur with Python 2.5 and the previous PyQt I was
using (4.5, I think), it seems that something has changed either with Python 2.6
or with PyQt 4.7.

It would be very nice to learn how to fix this without renaming directories,
since I use Matlab frequently.

Gib
 
G

Gib Bogle

The PyQt4 problem results from having copies of the Qt DLLs in directories that
are in the PATH, as Doug Bell discovered. In my case I have two programs that
use Qt, AMD CodeAnalyst and Matlab. If I rename BOTH these directories I can
import the PyQt4 modules.

Since this behaviour did not occur with Python 2.5 and the previous PyQt I was
using (4.5, I think), it seems that something has changed either with Python 2.6
or with PyQt 4.7.

It would be very nice to learn how to fix this without renaming directories,
since I use Matlab frequently.

Gib
 
D

Dennis Lee Bieber

The PyQt4 problem results from having copies of the Qt DLLs in directories that
are in the PATH, as Doug Bell discovered. In my case I have two programs that
use Qt, AMD CodeAnalyst and Matlab. If I rename BOTH these directories I can
import the PyQt4 modules.
And where are those PATH entries relative to the Python ones? You
may have to add the Python location to PATH /before/ the AMD and Matlab
entries. {I routinely -- once a year or so -- copy the PATH environment
variable to an editor, and reorder it so that the stuff I use most
occurs earlier in the list}
 
G

Gib Bogle

Dennis said:
And where are those PATH entries relative to the Python ones? You
may have to add the Python location to PATH /before/ the AMD and Matlab
entries. {I routinely -- once a year or so -- copy the PATH environment
variable to an editor, and reorder it so that the stuff I use most
occurs earlier in the list}

Well diagnosed! The others were all system environment variables, while the
PyQt4 PATH is mine, and therefore it was placed at the end. I've taken the AMD
and Matlab PATH entries out of the system list and put them after PyQt4 in my
PATH. Now peace and harmony are restored to my Python world.

Thanks
Gib
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,947
Members
47,498
Latest member
log5Sshell/alfa5

Latest Threads

Top