Re: Multiline plpython procedure

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Frank D(dot) Engel, Jr(dot)" <fde101(at)fjrhome(dot)net>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiline plpython procedure
Date: 2005-01-20 12:42:29
Message-ID: 20050120124219.GA12585@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 19, 2005 at 07:06:49PM -0500, Frank D. Engel, Jr. wrote:
> Uh, does the Python doc specify "platform" line endings, or "normal
> (\n)" line endings? It sounded to me like it always wanted the
> UNIX-style \n line endings, so that using those would result in
> portability...

That's the problem, Python specifies "platform" line endings. See this
note:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66434
> When working between platforms, it is often necessary to convert the
> line endings on files for them to work, especially when it comes to
> code. Pass Unix Python code with \r and it goes nowhere. Same on Mac
> Python with \n. This code simply and easily fixes the problem.

Note, one of these links provides a possible solution:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/59867
> This code eliminates the need to convert line endings when moving .py
> modules between OSes. Put in your sitecustomize.py, anywhere on
> sys.path, and you'll be able to import Python modules with any of
> Unix, Mac, or Windows line endings, on any OS.

I don't understand how it works, but people claim it solves their
problem...

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-01-20 12:55:54 Re: Unique Index
Previous Message Abdul-Wahid Paterson 2005-01-20 12:23:21 Re: Best Linux Distribution