By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,096 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,096 IT Pros & Developers. It's quick & easy.

Pb encodage & import

P: n/a
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
--
Michel Claveau

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi !

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


Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.