2014-06-24 47 views
0

我encoutner以下進口分辨率錯誤在我的節目:古怪的相對進口解析錯誤3.2.3

I am: homie.translators.is24.rest.translator 
Traceback (most recent call last): 
    File "/usr/local/sbin/is24rest", line 3, in <module> 
    from homie.interfaces.is24.rest import __main__ 
    File "/usr/local/lib/python3.2/dist-packages/homie/interfaces/is24/rest/__init__.py", line 8, in <module> 
    from .exporter import Exporter 
    File "/usr/local/lib/python3.2/dist-packages/homie/interfaces/is24/rest/exporter.py", line 12, in <module> 
    from homie.translators.is24.rest.translator import Translator 
    File "/usr/local/lib/python3.2/dist-packages/homie/translators/is24/rest/translator.py", line 9, in <module> 
    from .factories.rest.restFactory import RestFactory 
ImportError: No module named factories.rest.restFactory 

/usr/local/lib/python3.2/dist-packages/homie/translators/is24/rest/translator.py內容是

""" 
Created on 18.06.2014 

@author: Richard Neumann 
""" 
print('I am: ' + str(__name__)) 
from homie.translators.abc import Translator as T 

from .factories.rest.restFactory import RestFactory 
from .factories.openimmo.openimmoFactory import OpenImmoFactory 


class Translator(T): 
<snip> 

而且,相對模塊存在:

[email protected]:/usr/src/is24-translator# ls /usr/local/lib/python3.2/dist-packages/homie/translators/is24/rest/factories/rest/ 
abc.py attachments __init__.py __pycache__ realestates restFactory.py 

爲什麼python3試圖在這裏做一個絕對導入? 我只使用python 3.2.3在Debian 7下遇到這個問題。 Arch下w/python 3.4.1它工作得很好。

我錯過了什麼嗎?

回答

2

.factories中缺少__init__.py,導致此錯誤。 花了我一段時間才意識到這一點。