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

sys.path and unicode folder names

P: n/a
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
Feb 7 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Nir Aides wrote:
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
Feb 7 '06 #2

P: n/a
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.
Martin v. Lwis wrote:
Nir Aides wrote:
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

Feb 8 '06 #3

P: n/a
Nir Aides wrote:
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.
Martin v. Lwis wrote: 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


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
Feb 8 '06 #4

P: n/a
Nir Aides wrote:
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
Feb 8 '06 #5

P: n/a
The use of Python in a public health surveillance system is described
here (see references 15 and 26):
http://www.biomedcentral.com/1471-2458/5/141

Some more papers describing Python's starring role in some other public
health projects should appear in the next several months.

Tim C

Feb 8 '06 #6

P: n/a
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
Martin v. Lwis wrote:
Nir Aides wrote:
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

Feb 8 '06 #7

P: n/a
Nir Aides wrote:
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
Feb 8 '06 #8

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

Martin v. Lwis wrote:
Nir Aides wrote:
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

Feb 9 '06 #9

P: n/a
Tim Churches wrote:
The use of Python in a public health surveillance system is described
here (see references 15 and 26):
http://www.biomedcentral.com/1471-2458/5/141

Some more papers describing Python's starring role in some other public
health projects should appear in the next several months.


Might there be something for www.pythonology.com in the future?
Feb 9 '06 #10

P: n/a
Nir Aides wrote:
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
Feb 9 '06 #11

P: n/a
Martin v. Lwis wrote:
Nir Aides wrote:
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)?


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.
Python is Broken.


I agree. Please contribute a patch.


I will do my best.
Regards,
Martin

Feb 9 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.