Import Problem

Victor Subervi victorsubervi at gmail.com
Sun Dec 20 06:34:13 EST 2009


Hi;
I have this import statement:

from particulars import storePrimaryStandAlone, addStore, ourStores

particulars.py has this code:

def addStore():
  return 'jewelry'

def ourStores():
  return ['products', 'prescriptions']

def storePrimaryStandAlone():
  return 'prescriptions'

But I get this error:

/var/www/html/angrynates.com/cart/createTables2.py
  263 </html>
  264 '''
  265
  266 createTables2()
  267
createTables2 = <function createTables2>
 /var/www/html/angrynates.com/cart/createTables2.py in createTables2()
  105     these.append(basic)
  106   i = 0
  107   specialtyStore = addStore()
  108   addStore = []
  109   addStore.append(specialtyStore)
specialtyStore undefined, global addStore = <function addStore>

UnboundLocalError: local variable 'addStore' referenced before assignment
      args = ("local variable 'addStore' referenced before assignment",)

What's strange is that it imports ourStores just fine. but even if I copy
ourStores to addStore the latter doesn't get imported! Why? Now, I've worked
around this problem by just importing all of particulars, but why did my
import fail?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091220/950988ba/attachment.html>


More information about the Python-list mailing list