473,563 Members | 2,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

os.path.expandu ser on Windows: UnicodeEncodeEr ror

My application is getting this error on Windows XP (works fine on Mac OS X)
when it calls os.path.expandu ser:
UnicodeEncodeEr ror: 'ascii' codec can't encode characters in position
52-56: ordinal not in range(128)

The code was built with Python 2.3.4.

I found referenes to Path 957650, but I'm not familiar with how such fixes
are processed. Is there a patch I can add to fix this? How do I know what
version of Python it is fixed in - that is, will upgrading to Python 2.3.5
fix this?

Thanks for your help,

Bob Swerdlow
VP Engineering
Goombah - Music Discovery
rs*******@goomb ah.com
Jul 21 '05 #1
1 2473
Bob Swerdlow wrote:
My application is getting this error on Windows XP (works fine on Mac OS
X) when it calls os.path.expandu ser:
UnicodeEncodeEr ror: 'ascii' codec can't encode characters in position
52-56: ordinal not in range(128)
What does your environment look like? You can find out by typing
"SET" at a command prompt. The settings used are HOME, HOMEPATH and
HOMEDRIVE. Also helpful to print out the value being handed to
os.path.expandu ser.
I found referenes to Path 957650, but I'm not familiar with how such
fixes are processed. Is there a patch I can add to fix this? How do I
know what version of Python it is fixed in - that is, will upgrading to
Python 2.3.5 fix this?


The patch is still "Status: Open" so hasn't been applied to a
release. It is not certain that this will fix your problem. The main
benefit of the patch appears to be IMO that it will use the standard
USERPROFILE environment variable.

Neil
Jul 21 '05 #2

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

Similar topics

6
1954
by: Marco Aschwanden | last post by:
I want to store a file in the application directory. What is the easiest way to figure out, where my application is situated? sys.argv does not work for my purposes... do you have any other ideas. Thanks for any hint, Marco
9
2435
by: Amir Dekel | last post by:
Hi everyone, I have two problems: 1. How can I keep my changes in sys.path after closing the interpreter? 2. os.path.expanduser("~") always gives me "C:\\" instead of my homepath. I have tried to change my homepath in WinXP using set homepath(in command line), and alsaw using the "Environment Variables" in WinXP system properties, non...
6
1831
by: kimes | last post by:
I've just started digging into how python works.. I found that other mudules are clearly declared like one file per a module.. But the only os.path doesn't have their own file.. ye I know is has actually depending on os like in my case posixpath.. What I'd love to know is.. when I call import os.path.. how happened under the hood?
2
23368
by: Rob Cowie | last post by:
Hi, Given a string representing the path to a file, what is the best way to get at the filename? Does the OS module provide a function to parse the path? or is it acceptable to split the string using '/' as delimiters and get the last 'word'. The reason I'm not entirely happy with that method is that it is platform specific. I would prefer...
8
2260
by: Tony Nelson | last post by:
On *nix, ~/foo refers to a file in a user's home directory. On MSWindows, users normally look at "My Documents" in their home directory. ISTM that a file that my program would put in ~/. on Linux should be put in "~/My Documents/" (modulo os.path.normpath()) on MSWindows, where a user would expect it. How do you guys cope with this issue?...
2
2054
by: Kevin F | last post by:
where is this code looking for the .imap file? I am on OSX and am not sure where to put the file it is looking for. f = open(os.path.expanduser('~/.imap'))
0
976
by: Kevin F | last post by:
I have a code that opens an .imap file in os.path.expanduser. Unfortunately, I am on OS X and have no idea where that directory is. I am wondering how I can change this code to just open the .imap file in the directory where the code is saved. f = open(os.path.expanduser('~/.imap'))
1
5860
by: Peter Bienstman | last post by:
Hi, I'm trying to add support for unicode file names to my application. I'm running into problems with e.g. the os.path.exists routine, which complains if it gets passed a unicode string: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mnemosyne/pyqt_ui/main_dlg.py", line 149, in fileNew
6
3391
by: lampshade | last post by:
Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser("~/pictures/") print my_path
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
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. ...
1
7638
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...
0
6250
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...
1
5484
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...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
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
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.