Python Aborts when I quit

Steve Holden sholden at holdenweb.com
Thu Oct 18 12:11:51 EDT 2001


tilwe" <ashish.tilwe at db.com> wrote ...
> Hi,
>    I am relatively new to Python, but I am getting a strange error when
> I quit from Python. Here is the code:
> >>> import sys
> >>> import c_plusplus_module
> >>> print testvar()
> "OK"
> >>> sys.exit(0)
> Abort
>
> The c_plusplus_module imports a library developed in C++ to interface
Python.
> It look as follows
> ----------------------------------------------------
> #File c_plusplus_module.py
> import libPytAPI
>
> def testvar():
>     var foo = libPytAPI.load()
>     var retvar = "Failed"
>     if foo == 0:
>        retvar = "OK"
>     return retvar
>
> ----------------------------------------------------
>
> I am puzzled. Why should the import be OK, but when I exit
> the proocess aborts?.
> Can anyone indicate what could be potentially wrong in the code?
>
I too, am puzzled, but for a different reason. If you have indeed
cut-and-pasted the stuff above from Python interpreter sessions and files, I
am puzzled as to why you don't see error messages!

Firstly, shouldn't

>>> print testvar()

have been

>>> print c_plus_plus_module.testvar()

This leads me to suspect that you aren't running the code you think you are.
Also the fact that the import of your c_plus_plus_module gave no error leads
me to suspect that you are importing something else, as the "var" on two
lines of your testvar() function will generate syntax errors.

Perhaps you could let us know what the REAL problem is? Accuracy is
important for debugging, and lots of c.l.py readers will be able to help you
when they understand what you are really doing ... good luck!

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list