Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-22 Thread Jack Jansen
On 21-jan-05, at 14:07, Bob Ippolito wrote: On Jan 21, 2005, at 7:44, Jack Jansen wrote: On 21 Jan 2005, at 08:18, Stuart Bishop wrote: Just van Rossum wrote: Skip Montanaro wrote: Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. I don't think that in general you want to fold multiple

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-21 Thread Bob Ippolito
On Jan 21, 2005, at 7:44, Jack Jansen wrote: On 21 Jan 2005, at 08:18, Stuart Bishop wrote: Just van Rossum wrote: Skip Montanaro wrote: Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. I don't think that in general you want to fold multiple empty lines into one. This would be my pre

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-21 Thread Jack Jansen
On 21 Jan 2005, at 08:18, Stuart Bishop wrote: Just van Rossum wrote: Skip Montanaro wrote: Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. I don't think that in general you want to fold multiple empty lines into one. This would be my prefered regex: s = re.sub(r"\r\n?", "\n", s

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Stuart Bishop
Just van Rossum wrote: Skip Montanaro wrote: Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. I don't think that in general you want to fold multiple empty lines into one. This would be my prefered regex: s = re.sub(r"\r\n?", "\n", s) Catches both DOS and old-style Mac line endi

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Skip Montanaro
Just> Skip Montanaro wrote: >> Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. Just> I don't think that in general you want to fold multiple empty Just> lines into one. Whoops. Yes. Skip ___ Python-Dev mailing list Pyth

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Just van Rossum
Skip Montanaro wrote: > Just re.sub("[\r\n]+", "\n", s) and I think you're good to go. I don't think that in general you want to fold multiple empty lines into one. This would be my prefered regex: s = re.sub(r"\r\n?", "\n", s) Catches both DOS and old-style Mac line endings. Alternatively,

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-19 Thread Skip Montanaro
Stuart> I don't think it is possible for plpythonu to fix this by simply Stuart> translating the line endings, as this would require significant Stuart> knowledge of Python syntax to do correctly (triple quoted Stuart> strings and character escaping I think). I don't see why not.

[Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-19 Thread Stuart Bishop
There is a discussion going on at the moment in postgresql-general about plpythonu (which allows you write stored procedures in Python) and line endings. The discussion starts here: http://archives.postgresql.org/pgsql-general/2005-01/msg00792.php The problem appears to be that things are work