473,385 Members | 1,958 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,385 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 3433
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.