Bind compiled code to name?
Karlo Lozovina
_karlo_ at _mosor.net_
Sun Jun 22 14:12:00 EDT 2008
If string `source_code` contains Python source code, how can I execute
that code, and bind it to some name? I tried compiling with:
code_object = compile(source_code, 'errorfile', 'exec')
but then what to do with `code_object`?
P.S.
If my intentions aren't that clear, this is what I'm trying to do. I want
to emulate this:
import some_module as some_name
but with my code in `some_module` string, and not in file.
Thanks...
--
_______ Karlo Lozovina - Mosor
| | |.-----.-----. web: http://www.mosor.net || ICQ#: 10667163
| || _ | _ | Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|
More information about the Python-list
mailing list