ImportError: cannot import name content
I try to develop a site with askbot as one of its applications. Instead of installing askbot with e.g. easy_install, I grabbed the latest sources from git, and started to build around that. I worked my way across all the required dependencies, installing them one by one. The Django project using askbot is now able to find askbot modules and related dependencies without a problem.
Now, when I try to run syncdb and continue from there, I get the following error:
> manage syncdb
Traceback (most recent call last):
...
File "c:\git\askbot-devel\askbot\models\__init__.py", line 22, in <module>
from askbot.models.question import Question, QuestionRevision
File "c:\git\askbot-devel\askbot\models\question.py", line 22, in <module>
from askbot.models import content
ImportError: cannot import name content
While inspecting the askbot sources, I think I found a circular dependency between models/__init__.py (from askbot.models.question import Question, QuestionRevision) and models/question.py (from askbot.models import content). I guess the second import comes basically back to module __init__ to see what is exported, and __init__ is still not initialized. It might be that this behavior is due to my python version (2.7), but anyway it would be nice to get expert's opinion what is happening here.
From generic refactoring point of view, I think it's good to avoid circular dependencies. Perhaps you have already some plans to fix this problem? This assuming that my assumption here is the correct one :)
Comments