D
Dan Stromberg
What is this about? It's another n~ thing, but this time in 2.x.
All I'm doing is printing a str containing a character > 127.
It works fine in 2.5, to a terminal or to a pipe. In 2.6 and 2.7, it
fails when writing to a pipe but works fine writing to my terminal -
an mrxvt.\
I really kind of want octets to just be octets, since I'm on a Linux
system - it probably should be up to the user and their related
software to decide how those octets are interpreted. I'm assuming
that the bytes() workarounds I'm using in 3.x aren't going to work in
2.x - it looks like bytes() is just an alias for str() in 2.6 and 2.7.
BTW, the print(line) in the traceback looks like Python 3 syntax, and
it is I guess, but it's also Python 2 compatible. In 3.x, it's a
function with a single argument, in 2.x it's a statement with a
parenthesized expression.
Thanks!
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.5/bin/python
../test-readline0 2>&1 | cat
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
/usr/share/jpilot/MañanaDB.pdb
/usr/share/jpilot/jpilotrc.green
/usr/share/jpilot/jpilotrc.purple
/usr/share/jpilot/ContactsDB-PAdd.pdb
/usr/share/jpilot/MemoDB.pdb
/usr/share/jpilot/jpilotrc.blue
/usr/share/jpilot/ExpenseDB.pdb
/usr/share/jpilot/jpilotrc.default
/usr/share/jpilot/AddressDB.pdb
/usr/share/jpilot/ToDoDB.pdb
/usr/share/jpilot/TasksDB-PTod.pdb
/usr/share/jpilot/DatebookDB.pdb
/usr/share/jpilot/Memo32DB.pdb
/usr/share/jpilot/MemosDB-PMem.pdb
/usr/share/jpilot/jpilotrc.steel
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.6/bin/python
../test-readline0 2>&1 | cat
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
Traceback (most recent call last):
File "./test-readline0", line 22, in <module>
print(line)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
position 20: ordinal not in range(128)
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.6/bin/python
../test-readline0 2>&1
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
/usr/share/jpilot/MañanaDB.pdb
/usr/share/jpilot/jpilotrc.green
/usr/share/jpilot/jpilotrc.purple
/usr/share/jpilot/ContactsDB-PAdd.pdb
/usr/share/jpilot/MemoDB.pdb
/usr/share/jpilot/jpilotrc.blue
/usr/share/jpilot/ExpenseDB.pdb
/usr/share/jpilot/jpilotrc.default
/usr/share/jpilot/AddressDB.pdb
/usr/share/jpilot/ToDoDB.pdb
/usr/share/jpilot/TasksDB-PTod.pdb
/usr/share/jpilot/DatebookDB.pdb
/usr/share/jpilot/Memo32DB.pdb
/usr/share/jpilot/MemosDB-PMem.pdb
/usr/share/jpilot/jpilotrc.steel
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:41 PM
$
All I'm doing is printing a str containing a character > 127.
It works fine in 2.5, to a terminal or to a pipe. In 2.6 and 2.7, it
fails when writing to a pipe but works fine writing to my terminal -
an mrxvt.\
I really kind of want octets to just be octets, since I'm on a Linux
system - it probably should be up to the user and their related
software to decide how those octets are interpreted. I'm assuming
that the bytes() workarounds I'm using in 3.x aren't going to work in
2.x - it looks like bytes() is just an alias for str() in 2.6 and 2.7.
BTW, the print(line) in the traceback looks like Python 3 syntax, and
it is I guess, but it's also Python 2 compatible. In 3.x, it's a
function with a single argument, in 2.x it's a statement with a
parenthesized expression.
Thanks!
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.5/bin/python
../test-readline0 2>&1 | cat
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
/usr/share/jpilot/MañanaDB.pdb
/usr/share/jpilot/jpilotrc.green
/usr/share/jpilot/jpilotrc.purple
/usr/share/jpilot/ContactsDB-PAdd.pdb
/usr/share/jpilot/MemoDB.pdb
/usr/share/jpilot/jpilotrc.blue
/usr/share/jpilot/ExpenseDB.pdb
/usr/share/jpilot/jpilotrc.default
/usr/share/jpilot/AddressDB.pdb
/usr/share/jpilot/ToDoDB.pdb
/usr/share/jpilot/TasksDB-PTod.pdb
/usr/share/jpilot/DatebookDB.pdb
/usr/share/jpilot/Memo32DB.pdb
/usr/share/jpilot/MemosDB-PMem.pdb
/usr/share/jpilot/jpilotrc.steel
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.6/bin/python
../test-readline0 2>&1 | cat
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
Traceback (most recent call last):
File "./test-readline0", line 22, in <module>
print(line)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
position 20: ordinal not in range(128)
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:40 PM
$ find /usr/share/jpilot -print0 | /usr/local/cpython-2.6/bin/python
../test-readline0 2>&1
/usr/share/jpilot
/usr/share/jpilot/CalendarDB-PDat.pdb
/usr/share/jpilot/MañanaDB.pdb
/usr/share/jpilot/jpilotrc.green
/usr/share/jpilot/jpilotrc.purple
/usr/share/jpilot/ContactsDB-PAdd.pdb
/usr/share/jpilot/MemoDB.pdb
/usr/share/jpilot/jpilotrc.blue
/usr/share/jpilot/ExpenseDB.pdb
/usr/share/jpilot/jpilotrc.default
/usr/share/jpilot/AddressDB.pdb
/usr/share/jpilot/ToDoDB.pdb
/usr/share/jpilot/TasksDB-PTod.pdb
/usr/share/jpilot/DatebookDB.pdb
/usr/share/jpilot/Memo32DB.pdb
/usr/share/jpilot/MemosDB-PMem.pdb
/usr/share/jpilot/jpilotrc.steel
benchbox-dstromberg:~/src/home-svn/readline0/trunk i686-pc-linux-gnu
17932 - above cmd done 2010 Wed Dec 01 09:41 PM
$