[Tutor] Carriage return

Dave Angel davea at ieee.org
Mon Oct 12 12:41:03 CEST 2009


Alan Gauld wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">
> "Vineet Kothari" <vineet.kothari at gmail.com> wrote
>
>> I see that python IDLE add ^M as carriage return while programming in
>> windows machine.
>
> Thats just the Windows line ending.
> If you want to use the same file on both Windowscand Linux then
> you will need to either get used to it or run the DOS2Unix tool
> (and UNIX2DOS going back to Windows).
>
>> Can anyone help me as I use IDLE & I need to remove ^M from the end 
>> of every
>> line. Though it is not shown while programming but I can see that 
>> when I run
>> my scripts on debian linux environment & thus get errors.
>
> It shouldn't cause any faults in the programs when they run, it is
> just a nuisance when working in the editor. Some editors are intelligent
> enough to deal with this transparently - eg. I think vim and Scite 
> both do this.
> If you regularly edit on both OS then it might be worth moving from IDLE
> to one of those editors.
>
> HTH,
>
But the other problem I've seen when copying a DOS-formatted python 
script to Unix environment is that the shebang line is misinterpreted.  
(Some?) Unix shell will refuse to find the python interpreter if the 
file name seems to have a 0x0d in it.




More information about the Tutor mailing list