Python - execfile函数

时间:2017-06-27 06:11:30

标签: python

考虑我文件的内容" sandbox.py":

execfile('sandbox.py')

当我运行它时,它会产生如下巨大的重复错误:

Traceback (most recent call last):

  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
  File "sandbox.py", line 1, in <module>
    execfile('sandbox.py')
#(.... Same thing for about a 1000 more times...)
KeyError: 'unknown symbol table entry'

总之,有人可以解释刚刚发生了什么吗?为什么在使用execfile时没有其他错误与字典相关的错误?

0 个答案:

没有答案