sys.path and unicode folder names

N

Nir Aides

Hello,

Is there a solution or a work around for the sys.path problem with
unicode folder names on Windows XP?

I need to be able to import modules from a folder with a non-ascii name.

Thanks,
Nir
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Nir said:
Is there a solution or a work around for the sys.path problem with
unicode folder names on Windows XP?

I need to be able to import modules from a folder with a non-ascii name.

If the name is restricted to the CP_ACP code page (i.e. more than ASCII,
less then full Unicode), using the "mbcs" encoding should work fine.

Regards,
Martin
 
N

Nir Aides

I can not restrict the name to CP_ACP.
I am interested in the general case of Unicode.
Windows XP is a native Unicode OS.
 
T

Thomas Heller

Martin v. Löwis wrote:

Nir Aides:
I can not restrict the name to CP_ACP.
I am interested in the general case of Unicode.
Windows XP is a native Unicode OS.

Python internally converts unicode entries on sys.path to strings before
using them. Changing that would require a large rewrite of the import
machinery. I once started to work on a patch, but got ZERO feedback, so
I gave up.

Thomas
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Nir said:
I can not restrict the name to CP_ACP.
I am interested in the general case of Unicode.

So you should implement a patch, and contribute this
to sf.net/projects/python.

Regards,
Martin
 
N

Nir Aides

Actually, I already managed to make a Patch for this problem.
I will post it soon on my website and in this group.

But I find it strange that this problem even exists, and that I could
not find any workarounds on the Internet.

Nir
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Nir said:
Actually, I already managed to make a Patch for this problem.
I will post it soon on my website and in this group.

But I find it strange that this problem even exists, and that I could
not find any workarounds on the Internet.

Very few people use file names not in their respective CP_ACP (why
do you need such filenames?), and virtually nobody wants to put such
a file name on Python's sys.path (why do you want to? - just rename
the directory and be done).

Regards,
Martin
 
N

Nir Aides

If few people use file names not in their respective CP_ACP as you say,
why did Microsoft bother to make Windows XP a unicode OS?
It does not make any sense.

The existence of such bugs is the source of the problem itself.

It is because of this situation that people in non-English speaking
countries prefer to install English Windows XP. After all why should
they get all messed up with incompatible software?

And from my experience a considerable percent of these
stay-on-the-safe-side users have their CP_ACP pages setup incorrectly.

My software installs per-user Python modules in a sub-folder of the
User's Application-Data folder. The software itself resides under
Program-Files. The User's Application-Data folder will contain unicode
characters if the User's account name contains unicode characters.

You can argue that the design is good or wrong or can be altered to work
around the problem, but the fact remains:

Python is Broken.
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Nir said:
If few people use file names not in their respective CP_ACP as you say,
why did Microsoft bother to make Windows XP a unicode OS?

Because it simplifies their implementation, in the long run.
It is because of this situation that people in non-English speaking
countries prefer to install English Windows XP. After all why should
they get all messed up with incompatible software?

I see. Why do these people then refuse to change the code page of
their system (which *is* possible, even in English XP)?
Python is Broken.

I agree. Please contribute a patch.

Regards,
Martin
 
N

Nir Aides

Martin said:
Because it simplifies their implementation, in the long run.


I see. Why do these people then refuse to change the code page of
their system (which *is* possible, even in English XP)?

They don't refuse. You assume they actually know about its existence. I
think that in most cases they are not aware of that thing. Sometimes
they call their 10 year old neighbors to fix their computer if they are
tired of seeing garbage on their screen instead of readable characters,
but their computer usually crashes under the heavy load of dozens of
viruses and spy-ware long before that kid neighbor gets a chance to look
at it anyway.
I agree. Please contribute a patch.

I will do my best.
 

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
474,283
Messages
2,571,409
Members
48,103
Latest member
MadieDeitz

Latest Threads

Top