问题
I have the following stacktrace when I try to import ModuleA:
Traceback (most recent call last):
File "menu.py", line 9, in <module>
from tmserver import Module1
File "~/tmserver/Module1.py", line 10, in <module>
from tmserver.PackageA import ModuleA
File "~/tmserver/Package1/ModuleA.py", line 8, in <module>
from tmserver.Package2 import Module2
File "~/tmserver/Package2/Module2.py", line 15, in <module>
from tmserver.Package3 import Module3
File "~/tmserver/Package3/Module3.py", line 5, in <module>
from tmserver.PackageA import ModuleA
ImportError: cannot import name ModuleA
Is this because it's importing ModuleA again/recursively?
回答1:
That would seem like the logical conclusion; perhaps if you posted samples of the code you were running you'd be able to get a better reply?
来源:https://stackoverflow.com/questions/4707111/importerror-cannot-import-name-modulea