[issue14704] NameError Issue in Multiprocessing

Mark Dickinson report at bugs.python.org
Tue May 1 21:16:36 CEST 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

Thanks for the report.

This is expected behaviour.  It isn't actually anything to do with multiprocessing;  it's to do with invoking exec from within a function scope.  You can see the same effect with code like this:


code = """\
def show_name():
    print my_name
show_name()
"""

def run():
    my_name = "me"
    exec code

run()


See

http://docs.python.org/reference/executionmodel.html#interaction-with-dynamic-features

for more explanation.

----------
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14704>
_______________________________________


More information about the Python-bugs-list mailing list