Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我现在正在开发一个用 Python 编写的大型软件系统,其中包括多个模块。我想知道我应该怎么做,如果有人能理解我不断收到的这个错误消息:
File "<string>", line 1, in <module> NameError: name 'CerealObject' is not defined
使它非常神秘的是它似乎没有提供实际的文件名或特定的模块。从初学者的角度来看,这使得调试似乎是不可能的。
File "<string>"在异常堆栈跟踪中通常意味着您正在使用其中一个exec或eval某处。它们从字符串执行代码,因此没有实际的文件名。
File "<string>"
exec
eval
您需要查看堆栈跟踪的以下行以确定问题的根源。