473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Python 2.5 and Unicode on MacOS

I'm not sure whether this is a bug, or a feature that I do not fully
understand. I would therefore appreciate some advice, if you have any,
on the following problem:

I have just installed Python 2.5 (release) under MacOS 10.4.7 ("Tiger").
Unfortunately, the unit test "test_unicodefile.py" (in Lib/tests/)
exhibits a warning when invoked, as shown here:

[Lib/test] % python2.5 test_unicode_file.py
test_directories (__main__.TestUnicodeFiles) ... ok
test_unicode_file.py:103: UnicodeWarning: Unicode equal comparison
failed to convert both arguments to Unicode - interpreting them as being
unequal
filename1==filename2
test_equivalent_files (__main__.TestUnicodeFiles) ... ok
test_single_files (__main__.TestUnicodeFiles) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.252s

As you can see, the unit tests appear to pass, but I suspect there is a
hidden problem, as a subsequent build of the latest version of
BeautifulSoup now fails its unit tests, citing the same warning. I
can't tell whether this is a problem with the way BeautifulSoup is doing
things, or whether there is a more general problem with Unicode support
in the MacOS build of Python 2.5.

For reference, I have done a framework build of Python, and it seems to
work fine for everything else I have tried. Do you have any idea what
might be causing this trouble? I'd be grateful for your insights.

Cheers,
-M

--
Michael J. Fromberger | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
Sep 21 '06 #1
1 1666
Michael J. Fromberger wrote:
I'm not sure whether this is a bug, or a feature that I do not fully
understand. I would therefore appreciate some advice, if you have any,
on the following problem:

I have just installed Python 2.5 (release) under MacOS 10.4.7 ("Tiger").
Unfortunately, the unit test "test_unicodefile.py" (in Lib/tests/)
exhibits a warning when invoked, as shown here:

[Lib/test] % python2.5 test_unicode_file.py
test_directories (__main__.TestUnicodeFiles) ... ok
test_unicode_file.py:103: UnicodeWarning: Unicode equal comparison
failed to convert both arguments to Unicode - interpreting them as being
unequal
filename1==filename2
test_equivalent_files (__main__.TestUnicodeFiles) ... ok
test_single_files (__main__.TestUnicodeFiles) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.252s

As you can see, the unit tests appear to pass, but I suspect there is a
hidden problem, as a subsequent build of the latest version of
BeautifulSoup now fails its unit tests, citing the same warning. I
can't tell whether this is a problem with the way BeautifulSoup is doing
things, or whether there is a more general problem with Unicode support
in the MacOS build of Python 2.5.

For reference, I have done a framework build of Python, and it seems to
work fine for everything else I have tried. Do you have any idea what
might be causing this trouble? I'd be grateful for your insights.
This Problem is not Mac-specific. Should u"ö" == "ö" evaluate to True, or
False, or should it raise an exception?

I would favor always raising an exception, but the current behavior is the
result of an extensive discussion on python-dev (that I did not follow
completely) -- google for "unicode hell" and "dicts are broken".

My personal conclusion is not to mix unicode and non-ascii str. I hope I'm
safe then...

Peter

Sep 21 '06 #2

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

Similar topics

6
by: PhysicsGenius | last post by:
AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs. I have a wxPython program. It runs fine on OS X when I launch it from the Terminal ("pythonw appname.py") . The user wants to be able to...
3
by: Mark Schonewille | last post by:
Hello, I'm new on this list. I am looking for the OSA Python extension for MacOS 9. The MacOS X version can be downloaded here: ...
5
by: scott | last post by:
First my setup: I'm using the framework build of Python 2.4.1 ( http://bob.pythonmac.org/archives/2005/03/31/macpython-241-installer/ ) on an ibook G4 running Mac OS 10.3.8. I installed...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 407 open ( +3) / 3393 closed (+17) / 3800 total (+20) Bugs : 888 open (+28) / 6145 closed (+14) / 7033 total (+42) RFE : 232 open...
2
by: Dudeja, Rajat | last post by:
Hi, So, now I've finally started using Eclipse and PyDev as an IDE for my GUI Application. I just wrote some sample programs as an hands on. Now I would like to take up Tkinter. I'm using...
0
by: Mathieu Prevot | last post by:
2008/9/24 Jaime Huerta Cepas <jhuerta@cipf.es>: IMHO this is too complex to commit. Macport is a way to do what you want, but packages may not be up to date enough. Maybe the easiest and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.