> Why would that be admitting defeat?
>
> Well, it mean admitting defeat on solving the problem in python. Yes
You could still use Python to do the sorting. But it breaks the problem
into two separate and simpler processes. One simply sorts a file given
a particular data layout and sort algo
Stephen Nelson-Smith wrote:
Hi,
On Wed, Nov 11, 2009 at 10:05 AM, Alan Gauld wrote:
"Stephen Nelson-Smith" wrote
I don't really want to admit defeat and have a cron job sort the logs
before entry. Anyone got any other ideas?
Why would that be admitting defeat?
Well, i
On Wed, Nov 11, 2009 at 4:46 AM, Stephen Nelson-Smith
wrote:
> Hi Kent,
>
>> See the Python Cookbook recipes I referenced earlier.
>> http://code.activestate.com/recipes/491285/
>> http://code.activestate.com/recipes/535160/
>>
>> Note they won't fix up the jumbled ordering of your files but I don
Hi,
On Wed, Nov 11, 2009 at 10:05 AM, Alan Gauld wrote:
> "Stephen Nelson-Smith" wrote
>>
>> I don't really want to admit defeat and have a cron job sort the logs
>> before entry. Anyone got any other ideas?
>
> Why would that be admitting defeat?
Well, it mean admitting defeat on solving the
"Stephen Nelson-Smith" wrote
I don't really want to admit defeat and have a cron job sort the logs
before entry. Anyone got any other ideas?
Why would that be admitting defeat?
Its normal when processing large data volumes to break the
process into discrete steps that can be done in bulk an
Hi Kent,
> See the Python Cookbook recipes I referenced earlier.
> http://code.activestate.com/recipes/491285/
> http://code.activestate.com/recipes/535160/
>
> Note they won't fix up the jumbled ordering of your files but I don't
> think they will break from it either...
That's exactly the probl
Stephen Nelson-Smith wrote:
NameError: global name 'date' is not defined
How does __iter__ know about date? Should that be self.date?
S.
Yes.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.p
On Tue, Nov 10, 2009 at 11:25 AM, Stephen Nelson-Smith
wrote:
> So what I want to do is be able to multiplex the files - ie read the
> next line of all 12 files at once, filter them accordingly, and then
> write them out to one combined file.
>
> My old code did this;
>
> min((x.stamp, x) for x i
On Tue, Nov 10, 2009 at 3:59 PM, Stephen Nelson-Smith
wrote:
> On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith
> wrote:
>
>> OK, so now i've given it the full load of logs:
>>
> for time, entry in kent.logs:
>> ... print time, entry
>> ...
>> Traceback (most recent call last):
>> Fil
On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith
wrote:
> OK, so now i've given it the full load of logs:
>
for time, entry in kent.logs:
> ... print time, entry
> ...
> Traceback (most recent call last):
> File "", line 1, in ?
> ValueError: too many values to unpack
>
> How do I ge
Hello,
On Tue, Nov 10, 2009 at 2:00 PM, Luke Paireepinart
wrote:
>
>> Traceback (most recent call last):
>> File "", line 1, in ?
>> File "kent.py", line 11, in __iter__
>> if stamp.startswith(date):
>> NameError: global name 'date' is not defined
>>
>> How does __iter__ know about date? Sh
> Traceback (most recent call last):
> File "", line 1, in ?
> File "kent.py", line 11, in __iter__
>if stamp.startswith(date):
> NameError: global name 'date' is not defined
>
> How does __iter__ know about date? Should that be self.date?
>
Yes. self.date is set in the constructor.
_
Hi,
> probably that line should have been " ".join(line.split()[3:5]), i.e.
> no self. The line variable is a supplied argument.
Now I get:
Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more inform
On Tue, Nov 10, 2009 at 2:25 PM, Stephen Nelson-Smith
wrote:
>
>
>From here I get:
>
> import gzip
>
> class LogFile:
>def __init__(self, filename, date):
>self.logfile = gzip.open(filename, 'r')
>self.date = date
>
>def __iter__(self):
>for logline in self.logfile:
Hi Kent,
> One error is that the initial line will be the same as the first
> response from getline(). So you should call getline() before trying to
> access a line. Also you may need to filter all lines - what if there
> is jitter at midnight, or the log rolls over before the end.
Well ultimatel
On Tue, Nov 10, 2009 at 5:04 AM, Stephen Nelson-Smith
wrote:
> I have the following idea for multiplexing logfiles (ultimately into heapq):
>
> import gzip
>
> class LogFile:
> def __init__(self, filename, date):
> self.logfile = gzip.open(filename, 'r')
> for logline in self.logf
I have the following idea for multiplexing logfiles (ultimately into heapq):
import gzip
class LogFile:
def __init__(self, filename, date):
self.logfile = gzip.open(filename, 'r')
for logline in self.logfile:
self.line = logline
self.stamp = self.timest
17 matches
Mail list logo