Python error “ImportError: No module named”

后端 未结 29 2956
野的像风
野的像风 2020-11-22 07:46

Python is installed in a local directory.

My directory tree looks like this:

(local directory)/site-packages/toolkit/interface.py

29条回答
  •  無奈伤痛
    2020-11-22 08:17

    My two cents:

    enter image description here

    Spit:

    Traceback (most recent call last):
          File "bash\bash.py", line 454, in main
            import bosh
          File "Wrye Bash Launcher.pyw", line 63, in load_module
            mod = imp.load_source(fullname,filename+ext,fp)
          File "bash\bosh.py", line 69, in 
            from game.oblivion.RecordGroups import MobWorlds, MobDials, MobICells, \
        ImportError: No module named RecordGroups
    

    This confused the hell out of me - went through posts and posts suggesting ugly syspath hacks (as you see my __init__.py were all there). Well turns out that game/oblivion.py and game/oblivion was confusing python which spit out the rather unhelpful "No module named RecordGroups". I'd be interested in a workaround and/or links documenting this (same name) behavior -> EDIT (2017.01.24) - have a look at What If I Have a Module and a Package With The Same Name? Interestingly normally packages take precedence but apparently our launcher violates this.

    EDIT (2015.01.17): I did not mention we use a custom launcher dissected here.

提交回复
热议问题