473,804 Members | 3,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sys.path and unicode folder names

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
11 2857
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
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. Löwis 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
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. Löwis 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
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
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
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. Löwis 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
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
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. Löwis 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
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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
3933
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff in the os module got objectified properly (or at least with some semblance of OO propriety!) In the issues section:
14
2644
by: Thomas Heller | last post by:
I was trying to track down a bug in py2exe where the executable did not work when it is in a directory containing japanese characters. Then, I discovered that part of the problem is in the zipimporter that py2exe uses, and finally I found that it didn't even work in Python itself. If the entry in sys.path contains normal western characters, umlauts for example, it works fine. But when I copied some japanese characters from a random...
34
3272
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS: /python/nondist/sandbox/path/{path.py,test_path.py} One thing is still different, though: a Path instance won't compare to a regular string.
3
3207
by: Zenu | last post by:
Hi, I have a system with very long paths and I'm trying to use file.exist(Longpath) to test the paths existance but it gives a message that the path is too long. Can someone tell me how to manupulate long path in VB.NET. I am refering to fully qualified paths over 32000 characters where each component of the path could be up to 255 characters.
5
1757
by: Norman Diamond | last post by:
Here are two complete lines of output from Visual Studio 2005: 1>$B%W%m%8%'%/%H=PNO$K(B Authenticode $B=pL>$7$F$$$^$9(B... 1>Successfully signed: c:\T The first line means roughly: Doing Authenticode signature to project output. The second line is harder to translate. The reason is that the second line says it successfully signed something that doesn't exist. I don't have a
5
10329
by: Martin Carpella | last post by:
Hi! I know, that Path-names should be shorter than MAX_PATH (250), but the Win32-SDK allows specifiying longer names using the "\\?\" prefix. As I have an application that accesses files directly using the volume name instead of the drive letter (i.e. "\\?\Volume{...}\subdir\file.ext"), I sometimes get an PathTooLongException, as the total string exceeds 260 characters (due to the "\\?\Volume{...}\"-part).
4
1769
by: Robin Becker | last post by:
A kind user reports having problems running the reportlab tests because his path has non-ascii characters in it eg ......\Mes documents\Mes Téléchargements\Firefox\... somewhere in the tests we look at the path and then try and convert to utf8 for display in pdf. Is there a standard way to do these path string conversions?
24
3395
by: Donn Ingle | last post by:
Hello, I hope someone can illuminate this situation for me. Here's the nutshell: 1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale. 2. If this returns "C" or anything without 'utf8' in it, then things start to go downhill: 2a. The app assumes unicode objects internally. i.e. Whenever there is
3
1988
by: zhf | last post by:
I want ro walk a directory and its sub directory on linux, to find some shell script file, and run them, but I found some path belong blank charactor, such as '8000 dir', if I write as follow, I got error "no such file" path = '8000 dir' for root, dirs, files in os.walk(path): cmd = ' ' cmd = 'cd ' + root os.system(cmd)
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.