470,835 Members | 1,872 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,835 developers. It's quick & easy.

CTypes

I'm trying to install PyWinAuto for Python 2.4. It said that one of
the required libraries that I need to install would be CTypes. So I
head over to CTypes's SourceForge page and I installed CTypes for
Python 2.4. I go to run the PyWinAuto installation file and it throws
up this error:

C:\WINDOWS\Desktop\pywinauto-0.3.6>C:\Python24\Python setup.py install
Traceback (most recent call last):
File "setup.py", line 29, in ?
import pywinauto
File "C:\WINDOWS\Desktop\pywinauto-0.3.6\pywinauto\__init__.py",
line 28, in ?

import findwindows
File "C:\WINDOWS\Desktop\pywinauto-0.3.6\pywinauto\findwindows.py",
line 31, i
n ?
import win32functions
File "C:\WINDOWS\Desktop\pywinauto-0.3.6\pywinauto
\win32functions.py", line 14
9, in ?
GetModuleFileNameEx =
ctypes.windll.psapi.GetModuleFileNameExW

File "C:\PYTHON24\lib\site-packages\ctypes\__init__.py", line 387,
in __getatt
r__
dll = self._dlltype(name)
File "C:\PYTHON24\lib\site-packages\ctypes\__init__.py", line 312,
in __init__

self._handle = _dlopen(self._name, mode)
WindowsError: [Errno 1157] One of the library files needed to run this
applicati
on cannot be found

I have found out that anything that calls CTypes is producing this
error. I looked into the CTypes source and I found:

def __init__(self, name, mode=DEFAULT_MODE, handle=None):
self._name = name
if handle is None:
self._handle = _dlopen(self._name, mode) <errored line
else:
self._handle = handle

So my best guess is that I'm either missing a Python library or I'm
missing a DLL. Too bad I don't know which, does anyone know what I'm
missing?

Feb 3 '07 #1
5 3176
I forgot to mention I am running Windows 98SE.

Feb 3 '07 #2
Hi,

On Feb 3, 6:22 pm, "SoutoJ...@gmail.com" <SoutoJ...@gmail.comwrote:
I forgot to mention I am running Windows 98SE.
Hmm - pywinauto is not supported on Windows 98 - it relies competely
on Unicode.

You could try renaming all the functions ending in W to ending in A
e.g. change GetModuleFileNameExW to GetModuleFileNameExA - but I am
fairly sure that this would NOT solve all the problems you would have
trying to run on W98.

As far as I know (not 100% sure) but ctypes should have no problem on
W98 - it is a pywinauto requirement for Unicode.

Another thing to look into might be Unicows.dll (which gives some
Unicode functions to W98)

Mark

Feb 4 '07 #3
On Feb 4, 7:26 am, "Mark" <mark.m.mcma...@gmail.comwrote:

Hey, I really appreciate you responding to my post. I've been on this
problem for some days now and it was getting to me. Sad that pywinauto
doesn't run on Win98SE, are there any other Python libraries for
'automating' Windows COM? If not I looked into AutoIt, which is a
Windows automation tool. It has a DLL which I believe contains all the
methods it does in the scripting language it has. I read over the
(yeah, 'the'. I keep finding the exact same tutorial) ctypes tutorial,
and I don't get it. I don't get how to load a DLL. So if I had a
script file 'test.py' and a DLL 'AutoIt3X.DLL' in the same folder, how
could I load it? The tutorial did something like dll=windll.kernel32,
which I understands loads the kernel but I don't see how I could apply
that to load AutoIt3X. Thanks in advanced.

Feb 4 '07 #4
On 2/4/07, Dennis Lee Bieber <wl*****@ix.netcom.comwrote:
On 4 Feb 2007 05:16:27 -0800, "So*******@gmail.com"
<So*******@gmail.comdeclaimed the following in comp.lang.python:

script file 'test.py' and a DLL 'AutoIt3X.DLL' in the same folder, how
could I load it? The tutorial did something like dll=windll.kernel32,
which I understands loads the kernel but I don't see how I could apply
that to load AutoIt3X. Thanks in advanced.

I've not used ctypes, but from all the examples I've seen....

What happens if you specify:

dll = ctypes.windll.AutoIt3X

I think ctypes uses a getattr() trap to extract the dll name from
the invocation, then passes that to the Windows library loading code.
--
This is indeed what ctypes does. There's also a LoadLibrary static
method of windll.cdll etc that you can use to get it explicitly (like
if you need to load a DLL not on your path).

dll = ctypes.windll.LoadLibrary(r"C:\AutoIT#x.dll")
Feb 5 '07 #5
En Sat, 03 Feb 2007 13:01:56 -0300, So*******@gmail.com
<So*******@gmail.comescribió:
I'm trying to install PyWinAuto for Python 2.4. It said that one of
the required libraries that I need to install would be CTypes. So I
head over to CTypes's SourceForge page and I installed CTypes for
Python 2.4. I go to run the PyWinAuto installation file and it throws
up this error:

GetModuleFileNameEx =
ctypes.windll.psapi.GetModuleFileNameExW

So my best guess is that I'm either missing a Python library or I'm
missing a DLL. Too bad I don't know which, does anyone know what I'm
missing?
From the line above, should be "psapi.dll"
I don't know it.

--
Gabriel Genellina

Feb 5 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by achrist | last post: by
1 post views Thread by Thomas Heller | last post: by
19 posts views Thread by Thomas Heller | last post: by
1 post views Thread by sjdevnull | last post: by
6 posts views Thread by Jack | last post: by
1 post views Thread by moreati | last post: by
3 posts views Thread by Andrew Lentvorski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.