[python-win32] Module not found weirdness

Tim Roberts timr at probo.com
Tue Sep 19 18:58:40 CEST 2006


Derick Van Niekerk wrote:

> When I execute the code here
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 I get
> the following traceback:
>
> Traceback (most recent call last):
>  File "C:\Documents and Settings\Derick\Desktop\test.py", line 73, in ?
> frame = TestFrame ()
>  File "C:\Documents and Settings\Derick\Desktop\test.py", line 23, in
> __init__
> self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd)
> pywintypes.error: (126, 'SetClipboardViewer', 'The specified module
> could not be found.')
> Script terminated.
>
> I have run dependency walker and found that all the dlls load fine.


You ran dependency walker on which file?

> The other win32clipboard functions work fine as well, like getting and
> setting the clipboard contents. I have found that SetClipboardViewer (
> self.hwnd) should be in user32.dll but I have the same version
> installed as on my PC at work where the program runs without a problem.


How are you running this?  Are you running it from a command line, or
from inside an IDE, or double-clicking on the desktop, or what?  Which
version of Python?  Remember that, using Python 2.4 as an example,
python24.dll and pywintypes24.dll must be present in the DLL search
path, and that the environment variables for a proess started by
Explorer are not necessarily the same as the variables for a
command-line shell.

Is it possible you have multiple copies of Python installed, and that
the Explorer file association is pointing to the wrong one?  If you go
to a cmd shell and do "assoc .py" and then "ftype python.file" (assuming
that's what assoc said), does it point to the path you expect?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list