Hi !

I have a python script represented by a string.
I need to execute it in a context. 'exec' does
the job, but doesn't display the filename in
tracebacks. 'execfile' is displaying the filename
but it can only exec a script in a filesystem.

I have tried:
- to give exec a filename, like:

  exec script_content in dict({'__file__':'bla.py'})

  => didn't work (neighter with __name__)

- create an in-memory file subclassing 'file'

  class memfile(file):
    ..
    def read(self)..

  => also pointless as 'execfile' doesn't accept a file
    only a filename

Can you help me ?
The only problem I need to resolve is that I don't see
the script name in tracebacks.

Thanks,

BranoZ

PS: The script didn't came from the filesystem, but I know
  it's content and a name.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to