Installation of django-scheduler: $python manage.py runserver returns KeyError: u'__module__'

1.1k views Asked by At

I installed django-scheduler with pip (https://github.com/llazzaro/django-scheduler) and I edited settings.py as in the tutorial. When I run $python manage.py runserver I got this:

python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/__init__.py", line 1, in <module>
    from schedule.models.calendars import *
  File "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/calendars.py", line 110, in <module>
    class Calendar(with_metaclass(ModelBase, *get_model_bases())):
  File "/usr/lib/python2.7/dist-packages/six.py", line 617, in with_metaclass
    return meta("NewBase", bases, {})
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 71, in __new__
    module = attrs.pop('__module__')
KeyError: u'__module__'

I tried to reinstall Python (2.7), Django (1.7) and the app. I need a calendar app to my project and this seems the most complete.

Thanks.

2

There are 2 answers

1
Dan Russell On

I had this same issue. It turned out to be a problem with the version of python's six I had installed. I was using six version 1.6.1, and when I upgraded to version 1.9.0 it took care of this error. Run:

pip-2.7 install --upgrade six
0
Ashish Gupta On
run this script using djago-getversions.py

import pip
 installed_packages = pip.get_installed_distributions()
 installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
 for i in installed_packages])
  print(installed_packages_list)
----------------------------------------------------

check your django installed versions

after that compare or reinstall like these versions:

please check your this version:

[
   'adium-theme-ubuntu==0.3.4',
   'apt-xapian-index==0.45',
   'chardet==2.0.1',
   'colorama==0.2.5',
   'command-not-found==0.3',
   'debtagshw==0.1',
   'defer==1.0.6',
   'dirspec==13.10',
   'django-classy-tags==0.6.1',
   'django-cms==3.0.12',
   'django-mptt==0.6.1',
   'django-sekizai==0.8.1',
   'django-treebeard==3.0',
   'django==1.6.1',
   'djangocms-admin-style==0.2.5',
   'djangocms-link==1.5',
   'djangocms-snippet==1.4',
   'djangocms-text-ckeditor==2.4.3',
   'dnspython==1.11.1',
   'duplicity==0.6.23',
   'html5lib==0.999',
   'httplib2==0.8',
   'iniparse==0.4',
   'lockfile==0.8',
   'lxml==3.3.3',
   'mercurial==2.8.2',
   'mysql-connector-python==1.1.6',
   'mysql-python==1.2.3',
   'mysql-utilities==1.3.5',
   'oauthlib==0.6.1',
   'oneconf==0.3.7',
   'pam==0.4.2',
   'paramiko==1.10.1',
   'pexpect==3.1',
   'pillow==2.3.0',
   'pip==7.1.0',
   'piston-mini-client==0.7.5',
   'pycrypto==2.6.1',
   'pycups==1.9.66',
   'pycurl==7.19.3',
   'pygments==1.6',
   'pygobject==3.12.0',
   'pyopenssl==0.13',
   'pyserial==2.6',
   'pysmbc==1.0.14.1',
   'pysqlite==2.6.3',
   'python-apt==0.9.3.5ubuntu1',
   'python-debian==0.1.21-nmu2ubuntu2',
   'pyxdg==0.25',
   'reportlab==3.0',
   'requests==2.2.1',
   'sessioninstaller==0.0.0',
   'setuptools==3.3',
   'six==1.5.2',
   'software-center-aptd-plugins==0.0.0',
   'south==1.0.2',
   'system-service==0.1.6',
   'tortoisehg==2.10',
   'twisted-core==13.2.0',
   'twisted-web==13.2.0',
   'unity-lens-photos==1.0',
   'urllib3==1.7.1',
   'version==0.1.1',
   'virtualenv==13.0.1',
   'wheel==0.24.0',
   'wxpython-common==2.8.12.1',
   'wxpython==2.8.12.1',
   'xdiagnose==3.6.3build2',
   'youtube-dl==2015.7.7',
   'zope.interface==4.0.5'
]