Python import语句抛出异常

时间:2013-12-06 02:24:29

标签: python

我有一些看起来像这样的代码

try:
  import calvin.reasoning.rule_list
except:
  print "rule_list exception"

我已经在rule_list.py中注释掉了每个import语句,所以它看起来像这个

#import quantities
#import rules
#from conclusions import Conclusion
#from conclusions import Data
#from confidence import Validity

如果我删除了我的程序运行的rule_list的内容,但是如果没有循环导入,为什么python会抛出异常?

这是追溯

Traceback (most recent call last):
  File "/home/paul/projects/branchCalvin/Calvin/src/cscience/components/c_calibration.py", line 18, in <module>
    import calvin.reasoning.rule_list
  File "/home/paul/projects/branchCalvin/Calvin/src/calvin/reasoning/rule_list.py", line 37, in <module>
    import rules
  File "/home/paul/projects/branchCalvin/Calvin/src/calvin/reasoning/rules.py", line 32, in <module>
    import engine
  File "/home/paul/projects/branchCalvin/Calvin/src/calvin/reasoning/engine.py", line 33, in <module>
    import conclusions
  File "/home/paul/projects/branchCalvin/Calvin/src/calvin/reasoning/conclusions.py", line 31, in <module>
    import samples
  File "/home/paul/projects/branchCalvin/Calvin/src/calvin/reasoning/samples.py", line 30, in <module>
    from cscience import datastore
ImportError: cannot import name datastore
problem importing module components.c_calibration
(<type 'exceptions.ImportError'>, ImportError('cannot import name datastore',), <traceback object at 0x9ebc554>)

0 个答案:

没有答案