A modest Error (I mean Proposal)

Fredrik Lundh fredrik at pythonware.com
Fri Jan 21 06:52:16 EST 2000


Arinte <shouldbe at message.com> wrote:
> I am getting this weird error???
> Traceback (innermost last):
>   File "Beer", line 17, in ?
>   File "D:\POSSApps\anotherposs app\PossDevice.py", line 37, in IOCTL
>     if type(command)==type(2):
> TypeError: len() of unsized object

> Here is the code for the function it craps out on...

[snip]

is this the entire program, or are any user-written
C extensions involved in this?

a great way to get utterly weird errors is to have
a C extension function which ignores an internal
exception, but returns to Python without clearing
the error state (PyErr_Clear).

if you cannot fix the C code, you can clear the
error state from Python, using something like:

    mymodule.badfunction()
    hasattr(None, "none")

just after the C call.

</F>






More information about the Python-list mailing list