473,239 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 software developers and data experts.

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 3416
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: achrist | last post by:
I'm aving some trouble getting callbacks from a Delphi DLL back to python working through ctypes. The call from python to the DLL works fine. In the Delphi(5) code: type TCallbackFunc =...
2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
1
by: Thomas Heller | last post by:
ctypes 0.9.1 released - Sept 14, 2004 ===================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call...
19
by: Thomas Heller | last post by:
ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call...
1
by: sjdevnull | last post by:
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out how to set values to a variable inside the library. ...
7
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by...
6
by: Jack | last post by:
I'm not able to build IP2Location's Python interface so I'm trying to use ctypes to call its C interface. The functions return a pointer to the struct below. I haven't been able to figure out how...
1
by: moreati | last post by:
Recently I discovered the re module doesn't support POSIX character classes: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) on linux2 Type "help", "copyright", "credits" or "license" for...
0
by: Egor Zindy | last post by:
Egor Zindy wrote: #!/usr/bin/env python """ A generic chipid library based on ctypes This module handles most of the functions in FTChipID.dll
3
by: Andrew Lentvorski | last post by:
Basically, I'd like to use the ctypes module as a much more descriptive "struct" module. Is there a way to take a ctypes.Structure-based class and convert it to/from a binary string? Thanks,...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.