Re: [Tutor] Monitoring a logfile

2009-12-01 Thread R. Alan Monroe
> Varnish has a dedicated (but not always) reliable logger service. I'd > like to monitor the logs - specifically I want to check that a known > entry appears in there every minute (it should be there about 10 times > a minute). > What's going to be the best way to carry out this kind of check?

[Tutor] Monitoring a logfile

2009-12-01 Thread Stephen Nelson-Smith
Varnish has a dedicated (but not always) reliable logger service. I'd like to monitor the logs - specifically I want to check that a known entry appears in there every minute (it should be there about 10 times a minute). What's going to be the best way to carry out this kind of check? I had a lo

Re: [Tutor] read in ascii and plot

2009-12-01 Thread questions anon
I would now like to add a line of best fit. I think the command is polyfit()?? But I can't seem to get it to work f=open('e:/testscatter.txt') data=[map(float,line.split()) for line in f] x, y=zip(*data) pylab.polyfit(x,y,1) pylab.scatter(x,y) pylab.show() Any feedback will be greatly appreciated

Re: [Tutor] read in ascii and plot

2009-12-01 Thread questions anon
Excellent thank you!! On Mon, Nov 30, 2009 at 7:03 PM, Kent Johnson wrote: > On Mon, Nov 30, 2009 at 8:26 PM, Wayne Werner > wrote: > > > A sample of the data is always helpful, but I'll take a shot in the dark. > > If you have data like this: > > 2.31 72 > > 9823 > > ... ..

Re: [Tutor] numerical simulation + SQLite

2009-12-01 Thread Faisal Moledina
Thanks everyone for your responses! Alan Gauld wrote: > You may need to be realistic in your expectations. > A database is writing to disk which will be slower than working in memory. > And a 3GB file takes a while to read/traverse, even with indexes. It depends > a lot on exactly what you are d

Re: [Tutor] [Errno 9] Bad file descriptor

2009-12-01 Thread Dave Angel
Khalid Al-Ghamdi wrote: Hi everybody, I'm running python 2.6.1 on vista and I'm trying to use the csv module to write to a csv file and get the average of some numbers, but I keep getting the following error: Traceback (most recent call last): File "C:\Python31\MyCSVProjectFinal.py", line 83,

Re: [Tutor] python closures

2009-12-01 Thread Hugo Arts
On Tue, Dec 1, 2009 at 8:42 AM, spir wrote: > Great example, thank you. > > By the way, do you know the idiom: > > def makeInc(start): >   def inc(): >      inc.n += 1 >      print inc.n >   inc.n = start >   # 'start' may change now >   # ... >   return inc > > inc= makeInc(start=3) > inc() > > I

Re: [Tutor] python closures

2009-12-01 Thread spir
May I suggest that upvalues are analog to parameters passed by name? (which is indeed not Python's paradigm) Denis la vita e estrany http://spir.wikidot.com/ ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] python closures

2009-12-01 Thread spir
Dave Angel dixit: > Maybe a more complex example might show the various linkages. > > glob = 42 > > def outer(parm1): > free = 12 > free3 = 19 > def inner(parm2, parm3=free3): > print "global", glob, ", free vars", parm1, free, free3, ", > locals", parm2, parm3 > free =

Re: [Tutor] Equivalent exception of os.path.exists()

2009-12-01 Thread spir
bibi midi dixit: > Like i thought so, there is no exception to catch if a file already exist. > I've been browsing the many types of exceptions and cant find anything thats > close. Thank you for clarifying. > Actually, you can. I guess it's not the book author's intent, but you can try it for