ImportError: cannot import name ModuleA

2019-07-14 18:08发布

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条回答
疯言疯语
2楼-- · 2019-07-14 18:52

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?

查看更多
登录 后发表回答