Daniel Geržo wrote:
> On 23.4.2011 21:18, Thomas 'PointedEars' Lahn wrote:
>> Daniel Geržo wrote:
>>> [f = codecs.open(…, mode='rU', encoding='ascii') and f.newlines]
>>
>> […]
>> The only reason I can think of for this not working ATM comes from the
>> documentation, where it says that 'U' requir
Daniel Geržo wrote:
> Thomas 'PointedEars' Lahn wrote:
>> It is clear now that codecs.open() would not support universal newlines
>> from at least Python 2.6 forward as it is *documented* that it opens
>> files in *binary mode* only. The source code that I have posted shows
>> that it therefore a
On 24.4.2011 11:19, Thomas 'PointedEars' Lahn wrote:
It is clear now that codecs.open() would not support universal newlines from
at least Python 2.6 forward as it is *documented* that it opens files in
*binary mode* only. The source code that I have posted shows that it
therefore actively remov
Daniel Geržo wrote:
> On 24.4.2011 9:05, jmfauth wrote:
>> Use the io module.
>
> For the record, when I use io.open(file=self.path, mode="rt",
> encoding=enc)) as fobj:
>
> my tests are passing and everything seems to work fine.
>
> That indicates there is a bug with codecs module and universa
On 24.4.2011 9:05, jmfauth wrote:
Use the io module.
For the record, when I use io.open(file=self.path, mode="rt",
encoding=enc)) as fobj:
my tests are passing and everything seems to work fine.
That indicates there is a bug with codecs module and universal newline
support.
--
S pozdrav
On 23.4.2011 21:18, Thomas 'PointedEars' Lahn wrote:
Daniel Geržo wrote:
I need to detect the newline characters used in the file I am reading.
For this purpose I am using the following code:
def _read_lines(self):
with contextlib.closing(codecs.open(self.path, "rU")) as fobj:
On 23 avr, 22:25, Daniel Geržo wrote:
>
> Well I am doing this on:
> Python 2.7.1 (r271:86832, Mar 7 2011, 14:28:09)
> [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
>
> So what do you guys advise me to do?
>
> --
Use the io module.
jmf
--
http://mail.python.org/mailman/listinfo/python-list
Daniel Geržo wrote:
> Thomas 'PointedEars' Lahn wrote:
>> Chris Rebert wrote:
>>> Daniel Geržo wrote:
[f.newlines is None after f.readlines()
when f = codecs.open(…, mode='rU', encoding='ascii'),
but not when f = codecs.open(…, mode='rU')]
>>>
>>> […]
>>> I would speculate that th
On 23.4.2011 21:33, Thomas 'PointedEars' Lahn wrote:
Chris Rebert wrote:
On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote:
I need to detect the newline characters used in the file I am reading.
For this purpose I am using the following code:
def _read_lines(self):
with contextlib.cl
Chris Rebert wrote:
> On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote:
>> I need to detect the newline characters used in the file I am reading.
>> For this purpose I am using the following code:
>>
>> def _read_lines(self):
>> with contextlib.closing(codecs.open(self.path, "rU")) as fob
Daniel Geržo wrote:
> I need to detect the newline characters used in the file I am reading.
> For this purpose I am using the following code:
>
> def _read_lines(self):
> with contextlib.closing(codecs.open(self.path, "rU")) as fobj:
> fobj.readlines()
> if isinstance(fobj
On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote:
> Hello guys,
>
> I need to detect the newline characters used in the file I am reading. For
> this purpose I am using the following code:
>
> def _read_lines(self):
> with contextlib.closing(codecs.open(self.path, "rU")) as fobj:
> f
Hello guys,
I need to detect the newline characters used in the file I am reading.
For this purpose I am using the following code:
def _read_lines(self):
with contextlib.closing(codecs.open(self.path, "rU")) as fobj:
fobj.readlines()
if isinstance(fobj.newlines, tuple):
13 matches
Mail list logo