Nick Coghlan <ncogh...@gmail.com> added the comment:

This is a tricky one. Long term, the right approach is to migrate all the 
"scripts that run other scripts" over to runpy, but the runpy API needs work 
before we can do that (see #9325).

For bug fix purposes though, these modules can borrow some of runpy's 
infrastructure in order to fake the system state correctly. Specifically, the 
runpy._TempModule and runpy._ModifiedArgv0 context managers. (_TempModule may 
need a tweak to allow the module to be used to be passed in rather than always 
being implicitly created)

See runpy._run_module_code for an example of how to use them.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9914>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to