Unicode error in __unicode__(self) function

2017-05-08 Thread rmschne
I have a Django setup that has worked for a very long time. Yesterday I 
upgraded from Django 1.10 to 1.11.1 and am getting the error:

raise DjangoUnicodeDecodeError(s, *e.args)
django.utils.encoding.DjangoUnicodeDecodeErrorJón
: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in 
range(128). You passed in  ()

when in the code simply printing the "Meetingattendee" object with

def __unicode__(self):
print self.fname
return self.fname

The above is a simplified version. The error first cropped up on the more 
complex version

def __unicode__(self):
s=u'%s: %s, %s %s, %-12s, %s %s, %s, INV:%s, PO:%s, ItemCode:%s' % 
(self.id,self.meeting.date.strftime("%d-%b-%Y"),self.table,self.seat,\
self.attendeestatus.status,self.fname, self.lname, 
self.affiliation, \
self.invoiceno,self.ponumber,self.itemcode)
return s
 
where I eventually determined that the code was not working when working 
the field self.fname.

self.fname fails when it is "Jón".  Works fin with "Jon", of course.  

I have not tried to revert back to Django 1.10, but i guess that's the next 
step unless there is something in Django 1.11.1 that was changed that 
affects this. I can't find anything mentioned in the release notes.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d37cc78-7fe9-41b6-bcba-eb788465e54f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-08 Thread 'Tom Evans' via Django users
What data is "Jón"?

Is it u'J\xf3n' or something else? (print repr(self.fname))

Cheers

Tom

On Mon, May 8, 2017 at 5:10 PM, rmschne  wrote:
> I have a Django setup that has worked for a very long time. Yesterday I
> upgraded from Django 1.10 to 1.11.1 and am getting the error:
>
> raise DjangoUnicodeDecodeError(s, *e.args)
> django.utils.encoding.DjangoUnicodeDecodeErrorJón
> : 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in
> range(128). You passed in  ( 'soc_util.models.Meetingattendee'>)
>
> when in the code simply printing the "Meetingattendee" object with
>
> def __unicode__(self):
> print self.fname
> return self.fname
>
> The above is a simplified version. The error first cropped up on the more
> complex version
>
> def __unicode__(self):
> s=u'%s: %s, %s %s, %-12s, %s %s, %s, INV:%s, PO:%s, ItemCode:%s' %
> (self.id,self.meeting.date.strftime("%d-%b-%Y"),self.table,self.seat,\
> self.attendeestatus.status,self.fname, self.lname,
> self.affiliation, \
> self.invoiceno,self.ponumber,self.itemcode)
> return s
>
> where I eventually determined that the code was not working when working the
> field self.fname.
>
> self.fname fails when it is "Jón".  Works fin with "Jon", of course.
>
> I have not tried to revert back to Django 1.10, but i guess that's the next
> step unless there is something in Django 1.11.1 that was changed that
> affects this. I can't find anything mentioned in the release notes.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4d37cc78-7fe9-41b6-bcba-eb788465e54f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Lw_gfZANGr95XFM2RSoRVemtnv3YSvC3zK1FTgbnSiGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-08 Thread rmschne
Yes, it is the first name of a person with a European name, who it's got 
that "ó" character. My understanding that it is Unicode. The variable 
prints ok in the rest of the code to the screen and in Django templates, 
but this __unicode_(self) method fails. 


On Monday, 8 May 2017 17:22:42 UTC+1, Tom Evans wrote:
>
> What data is "Jón"? 
>
> Is it u'J\xf3n' or something else? (print repr(self.fname)) 
>
> Cheers 
>
> Tom 
>
> On Mon, May 8, 2017 at 5:10 PM, rmschne > 
> wrote: 
> > I have a Django setup that has worked for a very long time. Yesterday I 
> > upgraded from Django 1.10 to 1.11.1 and am getting the error: 
> > 
> > raise DjangoUnicodeDecodeError(s, *e.args) 
> > django.utils.encoding.DjangoUnicodeDecodeErrorJón 
> > : 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in 
> > range(128). You passed in  ( > 'soc_util.models.Meetingattendee'>) 
> > 
> > when in the code simply printing the "Meetingattendee" object with 
> > 
> > def __unicode__(self): 
> > print self.fname 
> > return self.fname 
> > 
> > The above is a simplified version. The error first cropped up on the 
> more 
> > complex version 
> > 
> > def __unicode__(self): 
> > s=u'%s: %s, %s %s, %-12s, %s %s, %s, INV:%s, PO:%s, ItemCode:%s' 
> % 
> > (self.id,self.meeting.date.strftime("%d-%b-%Y"),self.table,self.seat,\ 
> > self.attendeestatus.status,self.fname, self.lname, 
> > self.affiliation, \ 
> > self.invoiceno,self.ponumber,self.itemcode) 
> > return s 
> > 
> > where I eventually determined that the code was not working when working 
> the 
> > field self.fname. 
> > 
> > self.fname fails when it is "Jón".  Works fin with "Jon", of course. 
> > 
> > I have not tried to revert back to Django 1.10, but i guess that's the 
> next 
> > step unless there is something in Django 1.11.1 that was changed that 
> > affects this. I can't find anything mentioned in the release notes. 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/4d37cc78-7fe9-41b6-bcba-eb788465e54f%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e450ce55-cafa-4cb3-adda-6decea1c87cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-09 Thread Melvyn Sopacua
On Monday 08 May 2017 09:10:15 rmschne wrote:
> I have a Django setup that has worked for a very long time. Yesterday
> I upgraded from Django 1.10 to 1.11.1 and am getting the error:
> 
> raise DjangoUnicodeDecodeError(s, *e.args)
> django.utils.encoding.DjangoUnicodeDecodeErrorJón
> 
> : 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in
> 
> range(128).

I'm sorry - but this isn't your real error.
You will see it in your WSGI daemon logs once you set DEBUG to false. 

This error is caused by Django trying to print the error using ascii codec for 
the 
debug output (I haven't chased it down any further and I should really report 
it).

As said, your real error is somewhere else and that will probably make more 
sense.

-- 
Melvyn Sopacua

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9764105.YSOjKmLg3v%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-09 Thread rmschne
 

> I'm sorry - but this isn't your real error.
>
> You will see it in your WSGI daemon logs once you set DEBUG to false. 
>
>  
>
> This error is caused by Django trying to print the error using ascii codec 
> for the debug output (I haven't chased it down any further and I should 
> really report it).
>
>  
>
> As said, your real error is somewhere else and that will probably make 
> more sense.
>
>  
>
> -- 
>
> Melvyn Sopacua
>

Melvyn,

Thanks. I understand what you are saying. Obvious, but I didn't notice 
that. However, I do think it's a Django bug. This app is not running on a 
web server so there is no WSGI daemon.  Do you have a suggestion on what I 
can do to get a better detection of the error to enable reporting it? 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3ed676d-811a-4c53-b176-bd460f5dd54a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-09 Thread Vijay Khemlani
Paste the whole stack traceof the error

On 5/9/17, rmschne  wrote:
>
>
>> I'm sorry - but this isn't your real error.
>>
>> You will see it in your WSGI daemon logs once you set DEBUG to false.
>>
>>
>>
>> This error is caused by Django trying to print the error using ascii codec
>>
>> for the debug output (I haven't chased it down any further and I should
>> really report it).
>>
>>
>>
>> As said, your real error is somewhere else and that will probably make
>> more sense.
>>
>>
>>
>> --
>>
>> Melvyn Sopacua
>>
>
> Melvyn,
>
> Thanks. I understand what you are saying. Obvious, but I didn't notice
> that. However, I do think it's a Django bug. This app is not running on a
> web server so there is no WSGI daemon.  Do you have a suggestion on what I
> can do to get a better detection of the error to enable reporting it?
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b3ed676d-811a-4c53-b176-bd460f5dd54a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei13o3uH%2BVZK%3D6BE7tvf82KW6ccRPrP%3DfcHwZVyY9PydFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-09 Thread m712 - Developer
On May 9, 2017 11:42 AM, Melvyn Sopacua  wrote:
> I'm sorry - but this isn't your real error.
Your error is in another castle?




-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5911f4a1.d2d61c0a.786e9.2a60SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unicode error in __unicode__(self) function

2017-05-10 Thread Melvyn Sopacua
On Tuesday 09 May 2017 06:00:31 rmschne wrote:
> > I'm sorry - but this isn't your real error.
> > 
> > You will see it in your WSGI daemon logs once you set DEBUG to
> > false.
> > 
> > 
> > 
> > This error is caused by Django trying to print the error using ascii
> > codec for the debug output (I haven't chased it down any further
> > and I should really report it).
> > 
> > 
> > 
> > As said, your real error is somewhere else and that will probably
> > make more sense.
> > 
> > 
> > 
> > 
> > Melvyn Sopacua
> 
> Melvyn,
> 
> Thanks. I understand what you are saying. Obvious, but I didn't notice
> that. However, I do think it's a Django bug. This app is not running
> on a web server so there is no WSGI daemon.

Ah yes! That triggers a memory. Since `python manage.py runserver` runs on 
terminal the 
codec is set to ascii (even when using a UTF-8 locale). So set debug to false 
and see what 
comes up in the console.
Another way is to temporarily change the data to ascii. It should then still 
yield an error and 
that is your real one.

> Do you have a suggestion
> on what I can do to get a better detection of the error to enable
> reporting it?

Since runserver crashes, your options are limited. You could maybe construct a 
test case using 
django.test.Client[1] and see what is triggered.
-- 
Melvyn Sopacua


[1] https://docs.djangoproject.com/en/1.11/topics/testing/tools/#the-test-client

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2030225.42xNKJQA4H%40devstation.
For more options, visit https://groups.google.com/d/optout.