0

我的项目中有名为 fileimporter.py 的文件,当运行项目时,它会引发以下错误:

Traceback (most recent call last):
  File "C:\Users\myuser\Desktop\python\project\samples\clientlogin_example.py", line 54, in <module>
    CSVImporter(ft_client).importFile("data.csv")
  File "build\bdist.win-amd64\egg\fusiontables\fileimport\fileimporter.py", line 39, in importFile
ValueError: invalid literal for int() with base 10: '1S762e1A1XD1R97hy2LDgokzWo4fw_YWgUPbptlc'

在我班级的顶部,我有下面与项目结构相对应的行:

from project.fileimport.fileimporter import CSVImporter

问题是,我找不到路径“build\bdist.win-amd64\egg\”,即使我删除该文件或尝试修复它或清理并重建项目,同样的错误仍会继续出现。

它似乎是一个缓存文件,因为我已经删除了发生错误的行,但控制台中没有任何改变......

有人知道我怎么能找到那条路吗?

谢谢你

4

1 回答 1

0

这听起来很像一个遗留pyc文件。例如:

$ echo "def f(): raise Exception('footastic')" > foo.py
$ python -c "import foo"
$ python -c "import foo; foo.f()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "foo.py", line 1, in f
    def f(): raise Exception('footastic')
Exception: footastic

现在让我们删除foo.py并再试一次:

$ rm foo.py
$ python -c "import foo"
$ python -c "import foo; foo.f()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "foo.py", line 1, in f
Exception: footastic

移除剩余部分foo.pyc使其恢复正常:

$ rm foo.pyc
$ python -c "import foo"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named foo
于 2013-01-30T22:12:54.003 回答