On Fri, Jan 3, 2014 at 9:32 AM, Noah Fang <noah.ark@gmail.com> wrote:
Django newbie here. I just checked out and installed the latest dev version as instructed and created a project, but when trying to "python manage.py runserver", it gives the following error message.Anyone has any clue? Huge thanks!$ python manage.py runserverTraceback (most recent call last):File "/Users/noahark/Dev/django-trunk/django/apps/base.py", line 66, in createmodule = import_module(entry)File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/__init__.py", line 90, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "<frozen importlib._bootstrap>", line 1584, in _gcd_importFile "<frozen importlib._bootstrap>", line 1565, in _find_and_loadFile "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 584, in _check_name_wrapperFile "<frozen importlib._bootstrap>", line 1022, in load_moduleFile "<frozen importlib._bootstrap>", line 1003, in load_moduleFile "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapperFile "<frozen importlib._bootstrap>", line 868, in _load_moduleFile "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removedFile "/Users/noahark/Dev/django-trunk/django/contrib/admin/__init__.py", line 5, in <module>from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICALFile "/Users/noahark/Dev/django-trunk/django/contrib/admin/options.py", line 31, in <module>from django.shortcuts import get_object_or_404ImportError: bad magic number in 'django.shortcuts': b'\x03\xf3\r\n'
This error is a bit of a red flag -- it means that you've got mixed Python byte code versions. Somehow, you've generated byte code using one version of Python, and you're then running the code using a different version of Python.
Unfortunately, I have *no* idea how you might have caused this problem. It looks like you're running on a Mac, so it's possible that the system is getting confused over whether system python is Python 3 or Python 2 -- you're invoking "python manage.py runserver" at the command line and getting Python 3, but if some quirk of your environment is causing Python 2 to be the system default somewhere, you will get problems.
My suggestion here is to make sure you're running your code in a virtualenv [1] -- that will make sure that the "local" Python is always clear. Using virtualenv is good practice anyway for Python development, because it isolates the dependencies of each project from each other.
Yours,
Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq84-1wnKfA8fkzMOTWBHv51_ykPj6QWneKLvRs4Q6kurnuw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment