473,698 Members | 2,869 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 2484
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
1959
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
2441
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 helped. I really have to fix this somehow.
6
1838
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
23377
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 to use a built in method if possible. Cheers,
8
2273
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? ________________________________________________________________________ TonyN.:' ...
2
2064
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
987
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
5873
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
3396
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
8674
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8893
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
7723
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...
0
5860
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
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...
1
3045
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
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.