windll exception

Mike Palmer mike at ssi.com
Mon Dec 20 12:43:37 EST 1999


Below is a simple test file I wrote. It opens bwcc32.dll, and
runs the BWCCGetVersion() function to get the version, then
prints the version as a hex value. All that works fine.

As the output shows, an exception occurs when the program
finishes, but ONLY if I run it from the command line (NT4, SP4).
If open PythonWin and run it using execfile(), no exception is
reported.

I thought the problem might be related to the bwcc.unload() line,
but it doesn't matter whether I include that line or not. The
error message is the same.

This leads me to believe that Python is generating the error
on cleanup, and that somehow Python thinks None has been attached
to a class in the same way that bwcc was when I called
windll.module(). I suspect that I don't see the error from within
PythonWin because it's only generated when PythonWin closes, and
there probably isn't any mechanism to trap exceptions and report
them on closing.

Can anyone confirm this? Is there any known fix or workaround?

Thanks,

-- Mike --

------- Python windll test file -------
# Python windll test
import windll
bwcc = windll.module('bwcc32')
ver  = bwcc.BWCCGetVersion()
verstr = "%x" % ver
print verstr # should print '10200'
bwcc.unload()
----------------------------------------

------- Output -------
10200
Exception exceptions.AttributeError: "'None' object has no
  attribute 'free_library'" in <method module.__del__ of module
  instance at 7fd610> ignored
----------------------







More information about the Python-list mailing list