Pb encodage & import

  • Thread starter Michel Claveau - abstraction méta-galactique non t
  • Start date
M

Michel Claveau - abstraction méta-galactique non t

Bonsoir ! Hi !

My english is short, therefore, I do short.

Two scripts, "i1.py" and "i2.py" :

i1.py :
import i2
print i2.GlobalA

i2.py :
GlobalA ="azerty"




Like this, it's OK ; but :



i1.py :
import i2
print i2.GlobalA

i2.py :
GlobalA = "azerty"

OK

==============================

i1.py :
import i2
print i2.GlobalA

i2.py :
# -*- coding: cp1252 -*-

GlobalA = "azerty"

SyntaxError

==============================

i1.py :
import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = "azerty"

OK

==============================

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = "azerty"

OK

==============================

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: cp1252 -*-

GlobalA = "azerty"

SyntaxError

==============================

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
GlobalA = u"azérty" #see unicode & accent

OK

==============================

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = u"azérty" #see unicode & accent

UnicodeDecodeError

==============================


All files are recorded in ANSI ; tests with Python 2.4 on Win-XP.



Ideas, ou suggests ?




@-salutations
 
M

Michel Claveau - abstraction méta-galactique non t

Hi !

Wilk had give me a solution pour UnicodeDecode Error.
But no ideas for other problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top