[Python-bugs-list] [ python-Bugs-615123 ] Reimporting modules inside functions/cla

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Sep 2002 11:45:08 -0700


Bugs item #615123, was opened at 2002-09-26 20:44
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=615123&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
>Priority: 6
Submitted By: Jesús Cea Avión (jcea)
Assigned to: Nobody/Anonymous (nobody)
Summary: Reimporting modules inside functions/cla

Initial Comment:
Python 2.2.1 here.

Suppose this source code:

import sys
def a() :
  print sys.path
  import sys

When you execute "a()", I get the following error:

UnboundLocalError: local variable 'sys' referenced
before assignment


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=615123&group_id=5470