[issue12032] Tools/Scripts/crlv.py needs updating for python 3+

2011-05-08 Thread Stephen Ferg

New submission from Stephen Ferg zuuli...@ferg.org:

I think this is a consequence of the new Unicode support in Python 3+

Here is code copied from C:\Python32\Tools\Scripts\crlf.py (on windows)
==
for filename in os.listdir(.):
if os.path.isdir(filename):
print(filename, Directory!)
continue
data = open(filename, rb).read()
if '\0' in data:
print(filename, Binary!)
continue
newdata = data.replace(\r\n, \n)
if newdata != data:
print(filename)

===

When run, it produces this (run under the PyCharm debugger)

===
C:\Python32\python.exe C:/pydev/zob/zobtest.py
Traceback (most recent call last):
  File C:/pydev/zob/zobtest.py, line 134, in module
x() 
  File C:/pydev/zob/zobtest.py, line 126, in x
if '\0' in data:
TypeError: Type str doesn't support the buffer API

Process finished with exit code 1
===

Removing the test for \0 produces this:
===
C:\Python32\python.exe C:/pydev/zob/zobtest.py
Traceback (most recent call last):
  File C:/pydev/zob/zobtest.py, line 131, in module
x()  
  File C:/pydev/zob/zobtest.py, line 126, in x
newdata = data.replace(\r\n, \n)
TypeError: expected an object with the buffer interface

Process finished with exit code 1
===

--
components: Demos and Tools
messages: 135531
nosy: stephen_ferg
priority: normal
severity: normal
status: open
title: Tools/Scripts/crlv.py needs updating for python 3+
type: crash
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12032] Tools/Scripts/crlv.py needs updating for python 3+

2011-05-08 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset f94d74c85dcb by Victor Stinner in branch 'default':
Close #12032: Fix scripts/crlf.py for Python 3
http://hg.python.org/cpython/rev/f94d74c85dcb

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com