Message135531
| Author |
stephen_ferg |
| Recipients |
stephen_ferg |
| Date |
2011年05月08日.16:55:28 |
| SpamBayes Score |
2.9642955e-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: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 |
|