SystemError: error return without exception set

MRAB python at mrabarnett.plus.com
Thu Dec 7 13:28:18 EST 2017


On 2017-12-07 17:22, Chris Angelico wrote:
> On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung <natalieleung.29 at gmail.com> wrote:
>> I am trying to use Python to communicate and send commands in MSC Marc. A part of the code looks something like this:
>>
>> from py_mentat import*
>>
>> directory = '[specified the file path to my model]'
>> marcModel = '[name of my model]'
>>
>> py_echo(0)
>> openModel = '*new_model yes *open_model "'+ directory + marcModel +'"'
>> py_send(openModel)
>>
>>
>> The code stops at "py_send(openModel)" with an error message that reads: Traceback (most recent call last): File "[my file path]", line 11, in py_send(openModel)
>> SystemError: error return without exception set
>>
>> I tried running the code on different platforms (e.g. Command Prompt, Wing 101, python.exe) and I get the same result. What could be the problem?
> 
> In its purest sense, that error is a bug inside a Python extension
> module (as others have mentioned). Since the failure is basically
> "hey, you said you raised an exception, but I can't find the exception
> you thought you were raising", it's quite probable that there is a bug
> in your Python code; go back to the tutorial for Marc, and see if you
> can find an issue. Unfortunately you're flying blind here, but maybe
> you can figure something out even without the usual help of the error
> message.
> 
> But regardless, the bug first and foremost is in the extension module.
> The module's creator should be able to audit the py_send function to
> figure out where it is returning NULL without calling one of the
> "raise exception" functions.
> 
It's probably that the code is assuming that call somewhere to the 
Python API is returning a reference, but sometimes it isn't.

_All_ such return values should be checked for NULL.



More information about the Python-list mailing list