New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not callable #285

Open
brainwane opened this Issue Jan 22, 2017 · 8 comments

Comments

Projects
None yet
5 participants
@brainwane
Member

brainwane commented Jan 22, 2017

When I run a python manage.py commands, even if the commands seem to be running successfully, I sometimes get an error: TypeError: 'NoneType' object is not callable.

Example: when I ran python manage.py migrate auth and got that error, I thought the migration application hadn't finished, but evidently it had (as I found out when I ran it the second time). And then I ran python manage.py migrate and did not get the error.

(streetcrm) sumanah@penguin:~/test/streetcrm$ python manage.py migrate auth
/home/sumanah/test/streetcrm/streetcrm/settings.py:54: UserWarning: Check permissions on settings file, it contains sensitive data.
  "Check permissions on settings file, it contains sensitive data."
Operations to perform:
  Apply all migrations: auth
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7f6b2b4ceea0>
Traceback (most recent call last):
  File "/home/sumanah/test/streetcrm/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
(streetcrm) sumanah@penguin:~/test/streetcrm$ python manage.py migrate auth
/home/sumanah/test/streetcrm/streetcrm/settings.py:54: UserWarning: Check permissions on settings file, it contains sensitive data.
  "Check permissions on settings file, it contains sensitive data."
Operations to perform:
  Apply all migrations: auth
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fe3b46e7ea0>
Traceback (most recent call last):
  File "/home/sumanah/test/streetcrm/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
(streetcrm) sumanah@penguin:~/test/streetcrm$ python manage.py migrate
/home/sumanah/test/streetcrm/streetcrm/settings.py:54: UserWarning: Check permissions on settings file, it contains sensitive data.
  "Check permissions on settings file, it contains sensitive data."
Operations to perform:
  Synchronize unmigrated apps: messages, autocomplete_light, django_admin_bootstrapped, staticfiles
  Apply all migrations: watson, sessions, streetcrm, admin, auth, contenttypes
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying admin.0001_initial... OK
  Applying sessions.0001_initial... OK
  Applying streetcrm.0001_initial... OK
  Applying streetcrm.0002_auto_20150302_1118... OK
  Applying streetcrm.0003_auto_20150305_1131... OK
  Applying streetcrm.0004_auto_20150305_1134... OK
  Applying streetcrm.0003_auto_20150305_0913... OK
  Applying streetcrm.0005_merge... OK
  Applying streetcrm.0006_auto_20150310_1401... OK
  Applying streetcrm.0007_auto_20150310_1449... OK
  Applying streetcrm.0008_auto_20150317_1335... OK
  Applying streetcrm.0017_auto_20150324_1509... OK
  Applying streetcrm.0018_auto_20150324_1553... OK
  Applying streetcrm.0019_auto_20150402_1640... OK
  Applying streetcrm.0020_participant_institution... OK
  Applying streetcrm.0021_auto_20150407_1347... OK
  Applying streetcrm.0022_event_terminal... OK
  Applying streetcrm.0023_auto_20150407_1358... OK
  Applying streetcrm.0026_auto_20150429_1209... OK
  Applying streetcrm.0027_auto_20150429_1222... OK
  Applying streetcrm.0028_auto_20150429_1248... OK
  Applying streetcrm.0029_add_groups... OK
  Applying streetcrm.0030_auto_20150430_1917... OK
  Applying streetcrm.0031_auto_20150508_0656... OK
  Applying streetcrm.0029_auto_20150506_1109... OK
  Applying streetcrm.0030_institution_is_member... OK
  Applying streetcrm.0031_auto_20150506_1138... OK
  Applying streetcrm.0032_merge... OK
  Applying streetcrm.0033_auto_20150526_1145... OK
  Applying streetcrm.0034_auto_20150529_1458... OK
  Applying streetcrm.0035_auto_20150605_1600... OK
  Applying streetcrm.0036_convert_address_textfield... OK
  Applying streetcrm.0037_auto_20150610_1740... OK
  Applying streetcrm.0038_auto_20150611_1206... OK
  Applying streetcrm.0039_auto_20150624_2311... OK
  Applying streetcrm.0039_auto_20150623_1012... OK
  Applying streetcrm.0040_merge... OK
  Applying streetcrm.0041_auto_20150629_1040... OK
  Applying streetcrm.0042_auto_20150708_1437... OK
  Applying streetcrm.0043_remove_contact_title... OK
  Applying streetcrm.0044_auto_20150714_1351... OK
  Applying streetcrm.0045_auto_20150720_1619... OK
  Applying streetcrm.0046_auto_20150720_0710... OK
  Applying streetcrm.0047_auto_20150720_1657... OK
  Applying streetcrm.0048_auto_20150720_1822... OK
  Applying streetcrm.0049_add_permissions_to_groups... OK
  Applying streetcrm.0050_auto_20150807_1436... OK
  Applying streetcrm.0051_auto_20150810_0513... OK
  Applying streetcrm.0052_add_staff_permissions... OK
  Applying streetcrm.0053_auto_20150923_1723... OK
  Applying streetcrm.0054_more_staff_permissions... OK
  Applying streetcrm.0055_remove_tag_group... OK
  Applying streetcrm.0056_auto_20151006_1044... OK
  Applying streetcrm.0057_auto_20151019_1254... OK
  Applying streetcrm.0058_add_stages... OK
  Applying streetcrm.0059_add_leadership_permission... OK
  Applying streetcrm.0060_nonce_to_id... OK
  Applying streetcrm.0061_auto_20160420_1340... OK
  Applying watson.0001_initial... OK
(streetcrm) sumanah@penguin:~/test/streetcrm$ 

So I got the TypeError on the first migrate command, but not the second. Why?

And then:

(streetcrm) sumanah@penguin:~/test/streetcrm$ python manage.py createsuperuser
/home/sumanah/test/streetcrm/streetcrm/settings.py:54: UserWarning: Check permissions on settings file, it contains sensitive data.
  "Check permissions on settings file, it contains sensitive data."
Username (leave blank to use 'sumanah'): 
Email address: [omitted in this paste]
Password: 
Password (again): 
Superuser created successfully.
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fcc35fbbea0>
Traceback (most recent call last):
  File "/home/sumanah/test/streetcrm/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
[prompt]

But the superuser had been created successfully.

@cecilia-donnelly

This comment has been minimized.

Show comment
Hide comment
@cecilia-donnelly

cecilia-donnelly Jan 27, 2017

Contributor

That's fascinating. I don't remember ever seeing this error, and I don't see an obvious answer in line 117 or weakref.py. I'll keep an eye out for this in future installs and make a note here if I see it.

Contributor

cecilia-donnelly commented Jan 27, 2017

That's fascinating. I don't remember ever seeing this error, and I don't see an obvious answer in line 117 or weakref.py. I'll keep an eye out for this in future installs and make a note here if I see it.

@cecilia-donnelly

This comment has been minimized.

Show comment
Hide comment
@cecilia-donnelly

cecilia-donnelly Jan 31, 2017

Contributor

I'm now getting a seemingly related error:

Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    from django.core.management import execute_from_command_line
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/site-packages/django/utils/version.py", line 5, in <module>
    import subprocess
  File "/usr/lib/python3.5/subprocess.py", line 50, in <module>
    import signal
  File "/usr/lib/python3.5/signal.py", line 3, in <module>
    from functools import wraps as _wraps
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'

I don't know why I can't import _remove_dead_weakref, but I'm guessing it's a version problem. I'll report back!

Contributor

cecilia-donnelly commented Jan 31, 2017

I'm now getting a seemingly related error:

Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    from django.core.management import execute_from_command_line
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/site-packages/django/utils/version.py", line 5, in <module>
    import subprocess
  File "/usr/lib/python3.5/subprocess.py", line 50, in <module>
    import signal
  File "/usr/lib/python3.5/signal.py", line 3, in <module>
    from functools import wraps as _wraps
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/home/cdonnelly/OTS/repos/swoptact/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'

I don't know why I can't import _remove_dead_weakref, but I'm guessing it's a version problem. I'll report back!

@cecilia-donnelly

This comment has been minimized.

Show comment
Hide comment
@cecilia-donnelly

cecilia-donnelly Jan 31, 2017

Contributor

The delightful @nttaylor found this mailing list message, in which someone gets the same error when trying to install python 3.5. Note that this is on python 3.5.3 specifically, which was just released on January 17 and which I am also using. Suspicious! Unfortunately the message has not gotten any responses yet.

Contributor

cecilia-donnelly commented Jan 31, 2017

The delightful @nttaylor found this mailing list message, in which someone gets the same error when trying to install python 3.5. Note that this is on python 3.5.3 specifically, which was just released on January 17 and which I am also using. Suspicious! Unfortunately the message has not gotten any responses yet.

@thijstriemstra

This comment has been minimized.

Show comment
Hide comment
@thijstriemstra

thijstriemstra Feb 28, 2017

I'm seeing the same with mod_wsgi (randomly found this ticket through google) and python 3.5.3, just thought I'd share because it's very likely it's a python 3.5.3 issue.

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site.py", line 563, in <module>
    main()
  File "/usr/local/lib/python3.5/site.py", line 550, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/local/lib/python3.5/site.py", line 327, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/local/lib/python3.5/site.py", line 206, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/local/lib/python3.5/site.py", line 177, in addpackage
    import traceback
  File "/usr/local/lib/python3.5/traceback.py", line 5, in <module>
    import linecache
  File "/usr/local/lib/python3.5/linecache.py", line 8, in <module>
    import functools
  File "/usr/local/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/usr/local/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'

thijstriemstra commented Feb 28, 2017

I'm seeing the same with mod_wsgi (randomly found this ticket through google) and python 3.5.3, just thought I'd share because it's very likely it's a python 3.5.3 issue.

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site.py", line 563, in <module>
    main()
  File "/usr/local/lib/python3.5/site.py", line 550, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/local/lib/python3.5/site.py", line 327, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/local/lib/python3.5/site.py", line 206, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/local/lib/python3.5/site.py", line 177, in addpackage
    import traceback
  File "/usr/local/lib/python3.5/traceback.py", line 5, in <module>
    import linecache
  File "/usr/local/lib/python3.5/linecache.py", line 8, in <module>
    import functools
  File "/usr/local/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/usr/local/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
@thijstriemstra

This comment has been minimized.

Show comment
Hide comment
@thijstriemstra

thijstriemstra Feb 28, 2017

Could be fixed with this commit in 3.5 branch: python/cpython@9cd7e17

thijstriemstra commented Feb 28, 2017

Could be fixed with this commit in 3.5 branch: python/cpython@9cd7e17

@kfogel

This comment has been minimized.

Show comment
Hide comment
@kfogel

kfogel Mar 3, 2017

Member

Hey, thanks @thijstriemstra for taking the time to drop a comment here. We're usually running stock Debian, with whatever Python 3 is packaged in Debian 'testing' distro, so we'll see that change arrive in our installed Python soon. Once it does, we can test and see if the bug is still present.

(We could also build Python from source now and try it, of course, but since that train will be coming along any day now it probably makes more sense for us to work on other bugs in the meantime.)

Member

kfogel commented Mar 3, 2017

Hey, thanks @thijstriemstra for taking the time to drop a comment here. We're usually running stock Debian, with whatever Python 3 is packaged in Debian 'testing' distro, so we'll see that change arrive in our installed Python soon. Once it does, we can test and see if the bug is still present.

(We could also build Python from source now and try it, of course, but since that train will be coming along any day now it probably makes more sense for us to work on other bugs in the meantime.)

@mehemken

This comment has been minimized.

Show comment
Hide comment
@mehemken

mehemken Aug 25, 2017

I too was getting this. Upon closer inspection, I was on 3.5.3. I updated to 3.6.1 and I am no longer getting the error.

mehemken commented Aug 25, 2017

I too was getting this. Upon closer inspection, I was on 3.5.3. I updated to 3.6.1 and I am no longer getting the error.

@cecilia-donnelly

This comment has been minimized.

Show comment
Hide comment
@cecilia-donnelly

cecilia-donnelly Aug 25, 2017

Contributor

Thanks, @mehemken! Glad that worked for you.

Contributor

cecilia-donnelly commented Aug 25, 2017

Thanks, @mehemken! Glad that worked for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment