Oops, sorry Russell, the affected code is here (branch mistake):
https://github.com/cidadania/e-cidadania/blob/python3/src/core/spaces/models.py


2013/10/30 Oscar Carballal <[email protected]>

> Thanks Russell, I actually see a comma after the None... I'm not sure what
> you're referring to.
>
> Well, it's an opensource project, so here you go :)
> https://github.com/cidadania/e-cidadania
>
> The affected code is located here (both fields.py and models.py)
> https://github.com/cidadania/e-cidadania/tree/master/src/core/spaces
>
> Actually you're right, but even then ipdb doesn't show a very helpful
> output. I'm putting it in a pastebin to avoid cluttering the mail:
> https://dpaste.de/asTw
>
>
> 2013/10/30 Russell Keith-Magee <[email protected]>
>
>> Hi Oscar,
>>
>> The error you describe is the sort of thing that happens when a comma
>> goes missing, particularly in a list of tuples, but it's possible in other
>> circumstances, too.
>>
>> Take the following code as an example:
>>
>> x = [
>>   None
>>   (4, 5, 6)
>> ]
>>
>> On first inspection, this looks fine -- a list that contains a None and a
>>  tuple. But then you notice that there's no comma after the None -- so what
>> you're asking Python to do is to invoke None as a function, using (4,5,6)
>> as arguments. This causes a "NoneType object is not callable" error.
>>
>> In your case, the problem isn't manifesting at the raw syntactic level.
>> I'm not entirely sure how the setattr call you describe could be used to
>> generate this error, however.
>>
>> Unfortunately, its difficult to provide any more advice beyond this
>> without knowing more about your code. The error is being raised in your own
>> code space, so it isn't strictly a problem that Django itself is causing --
>> at best, it's an interaction between your code's expectations and what
>> Django is actually returning. If you're depending on some internal value in
>> Django's meta classes, and that value changed between 1.5.5 and 1.6rc1,
>> then it's possible you might start getting errors.
>>
>> I wouldn't read too much into where ipdb stops -- if you look at the
>> stack, it's stopped at the first frame in your own code (2 frames up from
>> where ./manage.py dumped stack).
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>> On Mon, Oct 28, 2013 at 4:31 PM, Oscar Carballal <[email protected]>wrote:
>>
>>> Hi,
>>>
>>> I'm starting to port my project (e-cidadania) into python 3 and django
>>> 1.6rc1, but I'm currently facing a problem that I can't understand.
>>>
>>> When I try to do a runserver or a syncdb or any other command, it breaks
>>> with this message:
>>>
>>> ➜  src git:(python3) ✗ ./manage.py syncdb
>>> TypeError: 'NoneType' object is not callable
>>>
>>> This is the full traceback:
>>>
>>> ➜  src git:(python3) ✗ ./manage.py syncdb --traceback
>>> Traceback (most recent call last):
>>>   File
>>> "/usr/lib/python3.3/site-packages/django/core/management/base.py", line
>>> 222, in run_from_argv
>>>     self.execute(*args, **options.__dict__)
>>>    File
>>> "/usr/lib/python3.3/site-packages/django/core/management/base.py", line
>>> 254, in execute
>>>     self.validate()
>>>   File
>>> "/usr/lib/python3.3/site-packages/django/core/management/base.py", line
>>> 280, in validate
>>>     num_errors = get_validation_errors(s, app)
>>>   File
>>> "/usr/lib/python3.3/site-packages/django/core/management/validation.py",
>>> line 35, in get_validation_errors
>>>     for (app_name, error) in get_app_errors().items():
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 166, in get_app_errors
>>>     self._populate()
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 72, in _populate
>>>     self.load_app(app_name, True)
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 96, in load_app
>>>     models = import_module('.models', app_name)
>>>   File "/usr/lib/python3.3/site-packages/django/utils/importlib.py",
>>> line 35, in import_module
>>>     __import__(name)
>>>   File "/usr/lib/python3.3/site-packages/guardian/models.py", line 89,
>>> in <module>
>>>     User = get_user_model()
>>>   File
>>> "/usr/lib/python3.3/site-packages/django/contrib/auth/__init__.py", line
>>> 127, in get_user_model
>>>     user_model = get_model(app_label, model_name)
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 230, in get_model
>>>     self._populate()
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 72, in _populate
>>>     self.load_app(app_name, True)
>>>   File "/usr/lib/python3.3/site-packages/django/db/models/loading.py",
>>> line 96, in load_app
>>>     models = import_module('.models', app_name)
>>>   File "/usr/lib/python3.3/site-packages/django/utils/importlib.py",
>>> line 35, in import_module
>>>     __import__(name)
>>>   File
>>> "/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py", line
>>> 31, in <module>
>>>     class Space(models.Model):
>>>   File
>>> "/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py", line
>>> 56, in Space
>>>     blank=True, null=True)
>>>   File
>>> "/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/fields.py", line
>>> 129, in __init__
>>>     setattr(self, att_name, dict(map(None, params_size, att)))
>>> TypeError: 'NoneType' object is not callable
>>>
>>>
>>> I though it might be a problem from django-stdimage, but doing an ipdb
>>> over the affected code returned this:
>>>
>>> ipdb> n
>>> TypeError: 'NoneType' object is not callable
>>> >
>>> /home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py(31)<module>()
>>>      30
>>> ---> 31 class Space(models.Model):
>>>      32
>>>
>>> Anyone has a clue of where could be the problem? The code runs just fine
>>> with python 2.7.5 and django 1.5.5
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> 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/CA%2BXe2iZ2-CCQ_DKtafRuxVr-X976Z7x3LYiZpaFCR9Dcg1LEZg%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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_TrUXZBkt09G29B3cpFuJ4wk%3DbL2-TKt6pP21%2BEpP6dQ%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CA%2BXe2ib1pMPsZ49jq%2BGBUP6SXAckgKJDzYQXfJfWUm_COv2tzA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to