[IPython-user] Re: Incomplete color support in IPython 0.6.0.

Fernando Perez fperez at colorado.edu
Sun May 16 14:37:49 CDT 2004


Pearu Peterson wrote:
> On Sat, 15 May 2004, Fernando Perez wrote:
> 
> 
>>it would be easy for me to enable auto-detection of this under Windows.  What 
>>I'm not too sure how to handle is cygwin: I suppose I should only do this for 
>>non-cygwin environments.  Is there a way under Windows to distinguish between 
>>python running under cygwin and under the normal environment?
> 
> 
> Yes, under cygwin sys.platform=='cygwin'.

Great, once I hear from the others whether this works, I can try then to make 
it more automatic.

>>>* The history is saved in native Windows format showing ^Ms at the end
>>>when one uses a shared Cygwin and Windows history file (this is not
>>>unique to IPython and shows in vanilla Python shell, too)
>>
>>Given that this is a fundamental problem of the Windows '\r\n' EOL convention, 
>>I don't see an easy way to work around it, sorry.
> 
> 
> Try using recent scipy_distutils from CVS for creating distributions. It
> makes the required mapping to dos or unix EOL convention depending whether
> the archive file is .zip or .tar, and indepenent of what is the original
> convention.

I don't think this solves it, since the history file is saved at runtime every 
time ipython closes, it's not a distribution-time issue.  The problem is the 
following (I think): he runs ipython under non-cygwin windows, and closes his 
session; this causes the history file to be saved as '\r\n'.  Then he opens 
ipython again, but now in a cygwin shell window: ipython loads the previous 
history file, but for cygwin the line ends are now wrong.

The history file is read by readline itself (not by ipython) via (iplib.py, 
line 616):

  readline.read_history_file(self.histfile)

After reading PEP 278:
http://www.python.org/peps/pep-0278.html
on the universal newline support, I think the right way to address this is 
through readline itself: the read_history_file() call should open files with 
the 'U' flag, to address this issue.  Do you folks agree?  I could file a bug 
report on SF for this.

Best,

f.




More information about the IPython-user mailing list