[GRASS-dev] usage of os.linesep (was: Re: [GRASS-SVN] r68240 - grass/trunk/scripts/v.report_
Huidae Cho
grass4u at gmail.com
Mon Apr 11 08:15:56 PDT 2016
What about this then? For reading text files, use \r\n. For reading
outputs from GRASS modules and writing, use os.linesep.
I think this makes sense because it can handle cross platform files safely
and it's very unlikely to have mixed newlines from modules compiled on the
same platform.
Or simply just use \r\n for reading and os.linesep for writing?
--
Sent from my phone
On Apr 11, 2016 10:58 AM, "Martin Landa" <landa.martin at gmail.com> wrote:
> Hi Huidae,
>
> {I took liberty to move discussion to ML}
>
> 2016-04-11 15:54 GMT+02:00 Huidae Cho <grass4u at gmail.com>:
> > That was a copy+paste from the same script, but I think \r\n is safer
> than
> > os.linesep just in case v.to.db prints out \r for whatever reason. But I
> > know that won't happen in non-Windows anyway, so os.linesep should be
> fine?
>
> hm, you are right, but still I would prefer to use os.linesep over
> '\r\n'. The only problem can happen when the user will ship generated
> files between Unix and Windows OS.
>
> Any comments from others?
>
> Thanks, Martin
>
> --
> Martin Landa
> http://geo.fsv.cvut.cz/gwiki/Landa
> http://gismentors.cz/mentors/landa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160411/67f177bb/attachment-0001.html>
More information about the grass-dev
mailing list