Message135531
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
=================================================================== |
|
Date |
User |
Action |
Args |
2011-05-08 16:55:31 | stephen_ferg | set | recipients:
+ stephen_ferg |
2011-05-08 16:55:31 | stephen_ferg | set | messageid: <1304873731.64.0.0794547908346.issue12032@psf.upfronthosting.co.za> |
2011-05-08 16:55:28 | stephen_ferg | link | issue12032 messages |
2011-05-08 16:55:28 | stephen_ferg | create | |
|