[wingide-users] ctypes on windows - windll is not defined
wishinet at googlemail.com
Thu Feb 25 15:23:54 MST 2010
Am 24.02.10 20:08, schrieb Mike Driscoll:
> On 1:59 PM, Marius wrote:
>> I'm giving WingIDE a try, however there's a cumbersome problem with
>> ctypes in my way:
>> It's a Windows XP SP III system, Python25, WingIDE.
>> I even tried to switch to Python26.
>> In any of these official Python versions ctypes is included by default.
>> from ctypes import *
>> print windll.kerel32
>> Easy as that is: in the interpreter it works perfectly, returning
>> <WinDLL 'kernel32', handle 7c8 blablabla>
>> However - using the debugger and running the script directly doesn't
>> work. Any time I import ctypes that works without any hassle, but I get:
>> "NameError: name 'windll' is not defined." When I use something from
>> - Same thing for Unions or anything ctypes related.
>> - However, forking an interpreter shell within WingIDE: no problems.
>> Does anybody know what's the issue here and how to get rid of it?
> If you actually ran that code in your example, it's no wonder why it
> didn't work. There is no "kerel32" method for the windll module.
> I tried running the following on my Windows XP SP 3 machine:
>>>> from ctypes import *
>>>> print windll.kernel32
> <WinDLL 'kernel32', handle 7c800000 at d93d90>
> It worked fine for me. I have Python 2.5.4 and Wing Pro 3.2.4-1.
Yes, thanks. But it wasn't the issue. It seems Wing's interpreter really
"spawn" with a different set of environment variables or it doesn't need
a proper PYTHONPATH on Windows. I had a PYTHONPATH referencing into
Python2.5\Lib\site-packages. After deletion Wing scraped through ctypes
and now it can successfully import ctypes.
So for the record: don't set a Pythonpath on Windows ;).
Thanks for the help!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 857 bytes
Desc: OpenPGP digital signature
Url : /pipermail/wingide-users/attachments/20100225/caaaa614/signature.bin
More information about the wingide-users