[PYTHONMAC-SIG] UNIX files
Just van Rossum
just@knoware.nl
Wed, 9 Oct 1996 22:13:46 +0100
At 2:08 PM 10/9/96, Guido van Rossum wrote:
>> Hmm, Jack, what would be required to make Python interpret Unix line
>> endings, or at least recognize them and display a warning?
>
>I'm not Jack, but I think there's only one or two places where modules
>are opened. I wonder if we could open the file in binary mode and if
>we detect a CR in the first 512 bytes, reopen it in text mode... The
>same hack should work for Windows! On Unix, don't do this at all.
I once suggested something like that to Jack (right after my first
encounter with the problem ;-) and he didn't sound too thrilled. I'd
already be *very* happy if it would raise a more descriptive error, instead
of the rather vague:
File "DevDev:JustPy:unixfiletest.py", line 1
sys.stdo sys.stdout = s#raw_input("--usb2x, b2y)1y, a2x,lccu b1y
= a1y + 2.0*(by- return b1x, b1y magic = calcQmagic(pi/2))/3 midx =
radius:xoffset + radius * m b2y = yoffse + xoffsetdy = radius *
cos(pi/4) + yoffset y = yost + radius * magic - radiusff print B1x, B1y,
Boffset, yoffset, mx, midy, b1x, def b1y = yoffset x = b2xc():agic
= ca print "def dra for i in ran x = ra print x, y, "l".5 * pi
* (i+1)) / segmentsngle tprint "S"t = sys.stdoutsymain()u dr
finally:", "w")e()c()ter-")
^
SyntaxError: invalid syntax
Or something. (And it takes forever to print that, since python thinks the
whole file is *one* line, and thinks it has to show the line with the
Syntax error)
Just
=================
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
=================