Star2Billing/django-audiofield — Issue #1: Import error with management commands
Author: globophobe
Created: 2012-02-26 03:48:51+00:00
State: open

In my models I used 'from audiofield.fields import AudioField'. This worked fine until I added a custom management command that imported a model with an AudioField.

There seemed to be a circular import. So, instead I changed my imports for my models to 'from audiofield.models import AudioField'

This seemed to solve the problem.

nobody@lemons:~/Docs/Code/wordsuperb$ python manage.py getsentences
Traceback (most recent call last):
File "manage.py", line 14, in
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/nobody/Docs/Code/wordsuperb/corpus/management/commands/getsentences.py", line 3, in
from corpus.models import Sentence
File "/home/nobody/Docs/Code/wordsuperb/corpus/models.py", line 11, in
from audiofield.fields import AudioField
File "/usr/local/lib/python2.6/dist-packages/django_audiofield-0.2.dev1-py2.6.egg/audiofield/fields.py", line 8, in
from tasks import audio_convert_task
File "/usr/local/lib/python2.6/dist-packages/django_audiofield-0.2.dev1-py2.6.egg/audiofield/tasks.py", line 2, in
from models import *
File "/usr/local/lib/python2.6/dist-packages/django_audiofield-0.2.dev1-py2.6.egg/audiofield/models.py", line 7, in
from audiofield.fields import AudioField
ImportError: cannot import name AudioField