All pastes #442005 Raw Edit

Something

public text v1 · immutable
·published 2007-04-15 23:38 UTC
rendered paste body
# lang file
#flowerhour.libs.lang.lang_US
lang_dict = {
   'hello' : 'hello',
   'welcome' : 'welcome',
}


# views.py file
lang_file = __import__(lang_file)
print lang_file.lang_dict['hello']
>>> AttributeError: 'module' object has no attribute 'lang_dict'


# From the command line
>>> lang_file = __import__('flowerhour.libs.lang.lang_US')
>>> lang_file
<module 'flowerhour' from '/home/babo/django/flowerhour/../flowerhour/__init__.pyc'>

>>> lang_dict
Traceback (most recent call last):
  File "<console>", line 1, in ?
NameError: name 'lang_dict' is not defined

>>> lang_file.lang_dict
Traceback (most recent call last):
  File "<console>", line 1, in ?
AttributeError: 'module' object has no attribute 'lang_dict'