내 사이트 패키지 디렉토리에 패키지가 설치되어 있습니다. 나는 나와 MyPkg
를 참조 help ('modules')
을 수행 할 때 폴더 구조는 다음과__init__ 파일에서 가져올 때 파이썬 오류가 발생했습니다.
MyPkg\
__init__.py
LogUtils\
__init__.py
logwrapper.py
Shortcuts\
__init__.py <-----this references LogUtils
somefile.py
것 같습니다.
>>> import MyPkg
>>> from MyPkg import LogUtils
>>> from MyPkg import Shortcuts
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from MyPkg import Shortcuts
File "C:\Python27\lib\site-packages\MyPkg\Shortcuts\__init__.py", line 1, in <module>
from GoToUrl import go_to_url
File "C:\Python27\lib\site-packages\MyPkg\Shortcuts\GoToUrl.py", line 1, in <module>
from LogUtils import logger, log
ImportError: No module named LogUtils
왜 LogUtils 혼자 잘 서 가져올 것입니다하지만, 초기화 파일을 통해 가져올 때 오류가 발생 ?? :하지만 IDLE에서 다음과 같은 오류가