Author stephen_ferg
Recipients stephen_ferg
Date 2011-05-08.16:55:28
SpamBayes Score 2.9643e-14
Marked as misclassified No
Message-id <1304873731.64.0.0794547908346.issue12032@psf.upfronthosting.co.za>
In-reply-to
Content
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
===================================================================
History
Date User Action Args
2011-05-08 16:55:31stephen_fergsetrecipients: + stephen_ferg
2011-05-08 16:55:31stephen_fergsetmessageid: <1304873731.64.0.0794547908346.issue12032@psf.upfronthosting.co.za>
2011-05-08 16:55:28stephen_ferglinkissue12032 messages
2011-05-08 16:55:28stephen_fergcreate