Embedded System - Trapping Errors

nelson_chenkin at seagate.com nelson_chenkin at seagate.com
Thu Jul 20 13:14:22 EDT 2000


I am embedding Python on a machine that does not have an output device.
A Python script file is sent down to this machine from a host via an
Ethernet connection and is then executed remotely. This is all working
like a charm.

Now I want to start intercepting script errors, converting the errors to
an format of my own design, then send them back up to the host machine
where they can be reported to the user.

Can this be done? I have stepped through the code in PyArg_ParseTuple()
to see what happpens when I intentionally provide the wrong number of
arguments. It seems like all this error handling is hard coded. There is
not any indirection that allows me to install an error handling hook.

I am running the script using PyRun_AnyFile(). By the time that returns
to me the error has been cleared - the hardcoded call to PyErr_Print()
which then calls PyErr_Fetch() clears it.

Obviously I can change the source code, but this presents a problem when
new Pythons versions are released.

Any help would be appreciated.
Thanks,
NC


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list