[python-win32] Re: python-win32] Re: inb() and outb() with Python
Win32 ?
Thomas Heller
theller at python.net
Tue Oct 19 11:56:39 CEST 2004
Tony Cappellini <tony at tcapp.com> writes:
> Thomas
>
> So what happens on Win2K, NT, and XP, when the below functions are called ?
>
> cdll.msvcrt._inp(...)
> cdll.msvcrt._outp
>
> I assume an exception- but I don't see how something like this could
> be caught in Python's exception handling.
Generally speaking, you cannot do port IO:
c:\sf\ctypes>python
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> windll.msvcrt._inp(0x80)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
WindowsError: exception: priviledged instruction
>>>
Windows throws an exception, that ctypes catches. I do not know what
you want to do, but it is possible to install a kernel mode driver that
allows access to some ports from user space - special peripherals that
are connected to the printer port, for example, may work this way.
Thomas
More information about the Python-win32
mailing list