Unicode issue with Python v3.3
nagia.retsina at gmail.com
nagia.retsina at gmail.com
Tue Apr 9 23:16:12 EDT 2013
Τη Τετάρτη, 10 Απριλίου 2013 12:34:25 π.μ. UTC+3, ο χρήστης Ian έγραψε:
> On Tue, Apr 9, 2013 at 3:10 PM, Νίκος Γκρ33κ <nikos.gr33k at gmail.com> wrote:
>
> > Hello, iam still trying to alter the code form python 2.6 => 3.3
>
> >
>
> > Everyrging its setup except that unicode error that you can see if you go to http://superhost.gr
>
> >
>
> > Can anyone help with this?
>
> > I even tried to change print() with sys.stdout.buffer() but still i get the same unicode issue.
>
> >
>
> > I don't know what to try anymore.
>
>
>
> It seems to be failing on the line:
>
>
>
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
>
>
>
> So the obvious question to ask is: what are the contents of
>
> os.environ['REMOTE_ADDR'] when this line is reached?
>
>
>
> And why are you still trying to solve these sorts of problems on your
>
> production website? Do you not have a development or staging
>
> environment?
No forget this line. this is not the problem.
No i don't have a testing enviroment, i altered all the code form 2.6 to 3.3 in the live enviromtnt.
i strongly believe there is somethign goind wrong with the prints(). Thoese are causing the unicode isu es much like as thes changes from:
quote = random.choice( list( open( "/home/nikos/www/data/private/quotes.txt", ) ) )
quote = random.choice( list( open( "/home/nikos/www/data/private/quotes.txt", encoding="utf-8" ) ) )
in order for the open() to work.
More information about the Python-list
mailing list