rexec and traceback

rogerducky at my-deja.com rogerducky at my-deja.com
Thu Jul 27 15:52:38 EDT 2000


Potentially a newbie question, but nobody else
seem to have asked this before...

Is it possible to use the traceback module along
with rexec to produce a stack trace?

Here's what I'm trying to do:

In one.py:
import traceback

print traceback.extract_stack()

------
In two.py:
import rexec
import traceback
import sys

#Added exc_info, which traceback needs.
class DHooks(rexec.RHooks):
        ok_sys_names = ('ps1','ps2', 'copyright',
'version', 'platform','exit', 'maxint',
'exc_info')

if __name__ == '__main__':
        env = rexec.RExec(DHooks())
        env.r_execfile('one.py')
-----
Executing one.py in the normal environment
produced the expected result.  Running under
rexec, however, exc_info simply will not return a
stack trace.  (Originally, I hoped it would return
a stack trace for the restricted environment...)

Reason for my wanting this?  Capture/printing of
error traces while within the restricted
environment.

Any help and/or suggestions would be appreciated.
Thanks,
Peter Yu


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



More information about the Python-list mailing list