Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
Hi, >> Any advice or experiences? >> > > go here and download the pdf! > http://www.dabeaz.com/generators-uk/ > Someone posted this the other day, and I went and read through it and played > around a bit and it's exactly what you're looking for - plus it has one vs. > slide of python vs. awk. > I

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
105.gz","[05/Nov/2009"),LogFile("c/access_log-20091105.gz","[05/Nov/2009")] while True: print [x.stamp for x in logs] nextline=min((x.stamp,x) for x in logs) print nextline[1].getline() -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
lly fast enough, with potentially 12 other files Hrm... S. On Mon, Nov 9, 2009 at 1:35 PM, Stephen Nelson-Smith wrote: > Hi, > >> If you create iterators from the files that yield (timestamp, entry) >> pairs, you can merge the iterators using one of these recipes: >&

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
On Mon, Nov 9, 2009 at 3:15 PM, Wayne Werner wrote: > On Mon, Nov 9, 2009 at 7:46 AM, Stephen Nelson-Smith > wrote: >> >> And the problem I have with the below is that I've discovered that the >> input logfiles aren't strictly ordered - ie there is variance b

[Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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 ? > Va

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
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, e

Re: [Tutor] Logfile multiplexing

2009-11-11 Thread Stephen Nelson-Smith
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

Re: [Tutor] Logfile multiplexing

2009-11-11 Thread Stephen Nelson-Smith
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? Wel

[Tutor] Iterator Merging

2009-11-11 Thread Stephen Nelson-Smith
. I've got the iterator merger in place too: >>> from imerge import imerge >>> imerge >>> imerge([1,3,4],[2,7]) >>> list(imerge([1,3,4],[2,7])) [1, 2, 3, 4, 7] What I'm trying to work out is how to feed the data I have - 6 streams of timestamp, ent

[Tutor] Iterable Understanding

2009-11-13 Thread Stephen Nelson-Smith
I think I'm having a major understanding failure. So having discovered that my Unix sort breaks on the last day of the month, I've gone ahead and implemented a per log search, using heapq. I've tested it with various data, and it produces a sorted logfile, per log. So in essence this: logs = [

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi, >> for log in logs: >>  l = log.getline() >>  print l >> >> This gives me three loglines.  How do I get more?  Other than while True: >> > I presume that what you want is to get all lines from each log. Well... what I want to do is create a single, sorted list by merging a number of other sor

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Gah! Failed to reply to all again! On Sat, Nov 14, 2009 at 1:43 PM, Stephen Nelson-Smith wrote: > Hi, >> I'm not 100% sure to understand your needs and intention; just have a try. >> Maybe what you want actually is rather: >> >> for log in logs: >>  for l

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi Wayne, > Just write your own merge: > (simplified and probably inefficient and first thing off the top of my head) > newlist = [] > for x, y, z in zip(list1, list2, list3): I think I need something like izip_longest don't I, since the list wil be of varied length? Also, where do these lists c

[Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Stephen Nelson-Smith
for him to work through - I must stress he has absolutely no clue at all about programming, no education beyond 16 yrs old, but is keen to learn. S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com ___ Tutor mail

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Stephen Nelson-Smith
Hi Martin, Thanks for a very detailed response. I'm about to head out, so I can't put your ideas into practice yet, or get down to studying for a while. However, I had one thing I felt I should respond to. > It's unclear from your previous posts (to me at least) -- are the > individual log file

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Stephen Nelson-Smith
> To upack your variables a and b you need an iterable object on the right > side, which returns you exactly 2 variables What does 'unpack' mean? I've seen a few Python errors about packing and unpacking. What does it mean? S. ___ Tutor maillist - T

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Stephen Nelson-Smith
Hi Marty, Thanks for a very lucid reply! > Well, you haven't described the unreliable behavior of unix sort so I > can only guess, but I assume you know about the --month-sort (-M) flag? Nope - but I can look it up. The problem I have is that the source logs are rotated at 0400 hrs, so I need t

[Tutor] GzipFile has no attribute '__exit__'

2009-11-16 Thread Stephen Nelson-Smith
I'm trying to write a gzipped file on the fly: merged_log = merge(*logs) with gzip.open('/tmp/merged_log.gz', 'w') as output: for stamp, line in merged_log: output.write(line) But I'm getting: Traceback (most recent call last): File "./magpie.py", line 72, in with gzip.open('

Re: [Tutor] I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Hello all, On Mon, Nov 16, 2009 at 6:58 AM, Stefan Lesicnik wrote: > hi, > > Although not a question, i just want to tell you guys how awesome you are! +1 I've been a happy member of this list for years, even though I've taken a 3 year Ruby sabbatical! I've always found it to be full of invalu

Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Hi, >> When i use our company's LAN i set my proxy variable by hand in .bashrc. >> There are 4 files to insert proxy variable: >> >> in ~/.bashrc, /root/.bashrc, /etc/wgetrc and /etc/apt/apt.conf. >> >> The last one is actually rename e.g. mv to apt.conf to activate proxy and mv >> to apt.conf.bak

Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Evening, > Yes, you can, but not this way.  I'm guessing the op was changing his mind > back and forth, between having two files, one for reading and one for > writing, and trying to do it in place.  The code does neither/both. Well, just neither I think! I didn't check if 'rw' was possible. My

Re: [Tutor] Do you use unit testing?

2009-11-16 Thread Stephen Nelson-Smith
ons? > > Just looking for input and different angles on the matter, from the > Python community. > -Modulok- > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/ma

[Tutor] Use of 'or'

2009-11-17 Thread Stephen Nelson-Smith
A friend of mine mentioned what he called the 'pythonic' idiom of: print a or b Isn't this a 'clever' kind or ternary - an if / else kind of thing? I don't warm to it... should I? S. ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

[Tutor] Readable date arithmetic

2009-11-18 Thread Stephen Nelson-Smith
I have the following method: def get_log_dates(the_date_we_want_data_for): t = time.strptime(the_date_we_want_data_for, '%Y%m%d') t2 = datetime.datetime(*t[:-2]) extra_day = datetime.timedelta(days=1) t3 = t2 + extra_day next_log_date = t3.strftime('%Y%m%d') return (the_date_we_want_da

[Tutor] Why are these results different?

2009-11-19 Thread Stephen Nelson-Smith
I'm seeing different behaviour between code that looks to be the same. It obviously isn't the same, so I've misunderstood something: >>> log_names ('access', 'varnish') >>> log_dates ('20091105', '20091106') >>> logs = itertools.chain.from_iterable(glob.glob('%sded*/%s*%s.gz' % >>> (source_dir,

[Tutor] Replace try: except: finally:

2009-11-20 Thread Stephen Nelson-Smith
ot;Disconnecting from %s..." % denormalize(key), connections[key].close() if state.output.status: print "done." How should I replace this? S. -- Stephen Nelson-Smith Technical Director Atalanta

Re: [Tutor] Iterable Understanding

2009-11-23 Thread Stephen Nelson-Smith
Martin, >    def __iter__(self): >        while True: >            for logline in self.logfile: >                heappush(self.heap, (timestamp(logline), logline)) >                if len(self.heap) >= self.jitter: >                    break >            try: >                yield heappop(self.he

[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

[Tutor] Trying to send a URL via XMPP

2009-12-10 Thread Stephen Nelson-Smith
gt;> xmlns='http://www.w3.org/1999/xhtml'>>> href='http://rt.sekrit.org.uk/rt3/Ticket/Display.html?id=#77'>Ticket #77 >>> updated.")) But every time I just receive the raw html Any idea what I am doing wrong? S. -- Stephen Nelson-Smith Technic

[Tutor] Modules and Test Suites

2009-12-29 Thread Stephen Nelson-Smith
f not, is there a better way than having all the tests in the same place as the rest of the code? S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com ___ Tutor maillist - Tutor@python.org To unsubscribe or c

[Tutor] [OT] Urgent Help Needed

2007-06-06 Thread Stephen Nelson-Smith
Hello friends, I urgently need to get hold of someone who can help me with the closing stages of a database project - porting data from an old system to a completely rewritten schema. My lead developer has suffered a bereavement, and I need a SQL expert, or programmer who could accomplish the por

Re: [Tutor] [OT] Urgent Help Needed

2007-06-06 Thread Stephen Nelson-Smith
On 6/6/07, Tim Golden <[EMAIL PROTECTED]> wrote: > You might want to mention the database (or databases) in > question. Given the short timeframes, people'd feel more > confident if it was the system they're familiar with. Sorry yes. We have an old (primitive) accounts system, which is basically

[Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Stephen Nelson-Smith
Hello friends, Over lunch today some colleagues discussed a question they are using as a conversation starter in some preliminary chats in our developer hiring process. The question was: "Place the following three in order: Inheritance, Polymorphism, Encapsulation." They specifically did not de

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Stephen Nelson-Smith
Michael Langford wrote: > Inheritance: Syntactic sugar that's not really needed to make a well > organized system. Often overused, especially by programmers in big > companies, beginning students of programmers, green engineers, and > professors. In practice hides a lot of data, often making behav

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, Michael Langford <[EMAIL PROTECTED]> wrote: > I do think this is a good question for getting a sense of where a > person's understanding is. I wonder how much this understanding is a > pre-requistite for being a good developer... not too much I hope! > > A good developer is a very load

Re: [Tutor] uncomprehension on RE

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, cedric briner <[EMAIL PROTECTED]> wrote: > Hello, > > I do not understand the behaviour of this: > > import re > re.search('(a)*','aaa').groups() > ('a',) > > I was thinking that the ``*'' will operate on the group delimited by the > parenthesis. And so, I was expecting this result: > (

Re: [Tutor] Finding even and odd numbers

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, Boykie Mackay <[EMAIL PROTECTED]> wrote: > Hi guys, > > I have come across a bit of code to find if a group of numbers is odd or > even.The code snippet is shown below: > > if not n&1: > return false > > The above should return false for all even numbers,numbers being > represented

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread Stephen Nelson-Smith
On 9/20/07, cedric briner <[EMAIL PROTECTED]> wrote: > To let you know, I'm writing a script to generate bind9 configuration > from a nis hosts table. So I was trying in a one re to catch from this: > > [ ...] [# comment] > e.g: > 10.12.23.45 hostname1 alias1 alias2 alias3 # there is a nice com

[Tutor] Permission Report

2007-10-07 Thread Stephen Nelson-Smith
Hello all, I have a tree of code on a machine which has been tweaked and fiddled with over several months, and which passes tests. I have the same codebase in a new virtual machine. A shell hack[0] shows me that the permissions are very different between the two. I could use rsync or something

[Tutor] Fwd: Permission Report

2007-10-08 Thread Stephen Nelson-Smith
Sorry... -- Forwarded message -- From: Stephen Nelson-Smith <[EMAIL PROTECTED]> Date: Oct 8, 2007 6:54 PM Subject: Re: [Tutor] Permission Report To: Alan Gauld <[EMAIL PROTECTED]> On 10/8/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > Yes, os.walk and os.st

Re: [Tutor] Fwd: Permission Report

2007-10-10 Thread Stephen Nelson-Smith
On 10/10/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Stephen Nelson-Smith wrote: > > But if I want to run the same procedure on a remote host, and store > > the results in a dictionary so they can be compared, what would I do? > > What kind of access do you have to t

[Tutor] VIX API

2007-10-11 Thread Stephen Nelson-Smith
Hello, Does anyone know if there are python bindings for the VMware VIX API? I googled for a bit, but didn't find them... How tricky would it be to wrap the C API? S. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tuto

[Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
Hello all, I wish to pull all the articles for one particular newsgroup to a local machine, on a regular basis. I don't wish to read them - I will be parsing the contents programatically. In your view is it going to be best to use an 'off-the-shelf' news reader, or ought it to be straightforward

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 2:13 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > ought it to be straightforward to write a client that does this task? Well: >>> server = NNTP('news.gmane.org') >>> resp, count, first, last, name = server.group("gmane.linux.re

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 4:01 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > >>> server = NNTP('news.gmane.org') > > What's wrong with that then? server, apparently:>>> s.group("gmane.discuss") ('211 11102 10 11329 gmane.disc

[Tutor] [OT] Vacancy - python systems programmer

2007-11-15 Thread Stephen Nelson-Smith
All, I may shortly be in the position of being able to hire a python systems programmer for a short contract (1-2 days initially to spike an ongoing project). The ideal person will have the following: * Solid experience of Python for systems programming and database interaction * Familiarity wit

[Tutor] Parsing Word Docs

2007-03-08 Thread Stephen Nelson-Smith
Hello all, I have a directory containing a load of word documents, say 100 or so. which is updated every hour. I want a cgi script that effectively does a grep on the word docs, and returns each doc that matches the search term. I've had a look at doing this by looking at each binary file and re

[Tutor] How do to an svn checkout using the svn module?

2007-03-09 Thread Stephen Nelson-Smith
Hello, I want to do a simple svn checkout using the python svn module. I haven't been able to find any/much/basic documentation that discusses such client operations. This should be very easy, I imagine! What do I need to do? S. ___ Tutor maillist -

Re: [Tutor] How do to an svn checkout using the svn module?

2007-03-09 Thread Stephen Nelson-Smith
On 3/9/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Did you find the pysvn Programmer's Guide that comes with pysvn? It has > this example: Ah.. no I haven't got pysvn installed... but will take a look. What I do have is: >>> import sys >>> import svn.core >>> import svn.client >>> import

Re: [Tutor] Parsing Word Docs

2007-03-09 Thread Stephen Nelson-Smith
On 3/8/07, Tim Golden <[EMAIL PROTECTED]> wrote: > Simplest thing's probably antiword (http://www.winfield.demon.nl/) > and then whatever text-scanning approach you want. I've gone for: #!/usr/bin/env python import glob, os url = "/home/cherp/prddoc" searchstring = "dxpolbl.p" worddocs = [] f

[Tutor] [OT] ETL Tools

2007-03-29 Thread Stephen Nelson-Smith
Hello all, Does anyone know of any ETL (Extraction, Transformation, Loading) tools in Python (or at any rate, !Java)? I have lots (and lots) of raw data in the form of log files which I need to process and aggregate and then do a whole bunch of group-by operations, before dumping them into text/r

[Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
Hi, I want to write a little script that parses an apache mod_status page. I want it to return simple the number of page requests a second and the number of connections. It seems this is very complicated... I can do it in a shell one-liner: curl 10.1.2.201/server-status 2>&1 | grep -i request |

Re: [Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
On 4/21/08, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > As usual there are a number of ways. > > But I basically see two steps here: > > 1.) capture all dt elements. If you want to stick with the standard > library, htmllib would be the module. Else you can use e.g. > BeautifulSoup or somethi

Re: [Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
Hi, > for lineno, line in enumerate(html): -Epython2.2hasnoenumerate() Can we code around this? > x = line.find("requests/sec") > if x >= 0: >no_requests_sec = line[3:x] >break > for lineno, line in enumerate(html[lineno+1:]): > x = line.find("requests currently being processed"

Re: [Tutor] HTML Parsing

2008-04-22 Thread Stephen Nelson-Smith
Hello, > For data this predictable, simple regex matching will probably work fine. I thought that too... Anyway - here's what I've come up with: #!/usr/bin/python import urllib, sgmllib, re mod_status = urllib.urlopen("http://10.1.2.201/server-status";) status_info = mod_status.read() mod_st

[Tutor] Sending Mail

2008-04-22 Thread Stephen Nelson-Smith
smtpserver = 'relay.clara.net' RECIPIENTS = ['[EMAIL PROTECTED]'] SENDER = '[EMAIL PROTECTED]' message = """Subject: HTTPD ALERT: %s requests %s connections Please investigate ASAP.""" % (rps, connections) session = smtplib.SMTP(smtpserver) smtpresult = session.sendmail(SENDER, RECIPIENTS, messag

[Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hi, I've been asked to produce a report showing all possible resources in a website, together with statistics on how frequently they've been visited. Nothing fancy - just number and perhaps date of last visit. This has to include resources which have not been visited, as the point is to clean ou

Re: [Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hello, >> This has to include resources which have not been visited, as the >> point is to clean out old stuff. > > Take a look at AWStats (not Python). Doesn't this 'only' parse weblogs? I'd still need some kind of spider to tell me all the possible resources available wouldn't I? It's a big

[Tutor] Init Scripts

2008-07-04 Thread Stephen Nelson-Smith
Hello, I've been wrestling with some badly written init scripts, and picking my way through the redhat init script system. I'm getting to the point of thinking I could do this sort of thing in Python just as effectively. Are there any pointers available? Eg libraries that give process informati

[Tutor] Python and NT Authentication

2008-08-07 Thread Steven L Smith
t;, "+row.first_name+" ("+row.uid+")") cursor.close() %> (for testing purposes, I actually built a table in the database just so that I could populate it programmatically, but this is where I'd like to pull the info from Active Directory. Hope someone can

[Tutor] Accessing LDAP

2008-08-11 Thread Steven L Smith
Any ideas how I can pull a list of domain users from an LDAP server and use it programmatically in a Python web application? Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Accessing LDAP

2008-08-11 Thread Steven L Smith
ge - From: "Rudy Schockaert" <[EMAIL PROTECTED]> To: "vishwajeet singh" <[EMAIL PROTECTED]> Cc: "Steven L Smith" <[EMAIL PROTECTED]>, "tutor" Sent: Monday, August 11, 2008 9:04:50 AM (GMT-0500) America/New_York Subject: Re: [Tutor] Accessing

Re: [Tutor] Accessing LDAP

2008-08-11 Thread Steven L Smith
<% import active_directory for person in active_directory.search ("objectCategory='Person'"): Response.Write(person.displayName) %> Results in... Python ActiveX Scripting Engine error '80020009' Traceback (most recent call last): File "

Re: [Tutor] Accessing LDAP

2008-08-11 Thread Steven L Smith
CTED]> To: "Steven L Smith" <[EMAIL PROTECTED]> Cc: "tutor" Sent: Monday, August 11, 2008 11:37:35 AM (GMT-0500) America/New_York Subject: Re: [Tutor] Accessing LDAP Ok, then you best stick to Tim's module. Are you running your script from a workstation

[Tutor] Short Contract

2008-09-08 Thread Stephen Nelson-Smith
Hello, I'm looking for someone to help on a short contract to build a centralised blogging system. I want a planet-style aggregation of blogs, but with the ability to see and make comments on each individual blog, from the central planet page. Ideally, it would also have a little 'icon' mug-shot

[Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
I want to write a program that connects to a TCP port using telnet, and issues commands, parsing the output the command provides, and then issuing another command. This might look like this: $ telnet water.fieldphone.net 7456 Welcome to water, enter your username >_ sheep Enter your password >_ s

Re: [Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
Hi, > How about pexpect; > http://www.noah.org/wiki/Pexpect Ah yes - I've used that before to good effect. ATM I'm playing with telnetlib. Is there a way to read everything on the screen, even if I don't know what it will be? eg: c = telnetlib.Telnet("test.lan") c.read_until("name: ") c.write(

Re: [Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
Hi, > I effectively want something like c.read_everything() Looks like read_very_eager() does what I want. S. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Tutor Ilde running problems

2011-11-16 Thread Nidian Job-Smith
Hi all, Just installed python 2.7.2 on my windows 7 32-bit laptop. However when I attempt to run idle it wont open (nothing happens) Wondered if any of you have had this problem and have any tips? Cheers> ___ > Tutor maillist - Tutor@python.org > To u

[Tutor] (no subject)

2011-11-17 Thread Nidian Job-Smith
Hi all, I'm new to programming (thus Python), so after reading the basics, I wanted to practise what I've learnt . I've come across a beginners exercise which is to programme rot13. I've written some code but it doesn't seem to work Here it is: def rot13(s):char_low = ()result = ""

[Tutor] Rot13

2011-11-17 Thread Nidian Job-Smith
Hi all, I'm new to programming (thus Python), so after reading the basics, I wanted to practise what I've learnt . I've come across a beginners exercise which is to write the code for rot13.   I've written some code but it doesn't seem to work When I run it I get this error: NameError: glo

Re: [Tutor] Rot13

2011-11-17 Thread Nidian Job-Smith
Sorry about the code format in last E-mail. I'll attach the code in notepad, as my e-mail doesnt seem to like sending plain text.. > From: nidia...@hotmail.com > To: st...@pearwood.info; tutor@python.org > Date: Thu, 17 Nov 2011 17:45:11 + > Subject:

[Tutor] Encoding

2011-11-17 Thread Nidian Job-Smith
Hi all, In my programme I am encoding what the user has in-putted. What the user inputs will in a string, which might a mixture of letters and numbers. However I only want the letters to be encoded. Does any-one how I can only allow the characters to be encoded ?? Big thanks,

Re: [Tutor] Doctest error!

2011-11-17 Thread Nidian Job-Smith
> Date: Thu, 17 Nov 2011 22:49:33 -0500 > From: d...@davea.name > To: nidia...@hotmail.com > CC: tutor@python.org > Subject: Re: [Tutor] Doctest error! > > On 11/18/2011 10:29 AM, John wrote: > > > > Hi all, > > When i run a doctest on this piece of code

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Nidian Job-Smith
To answer your questions Steven What is the intention of this function? The name given doesn't mean anything to me. The parameters "names" and "step" don't seem meaningful. I can see what the function does: it deletes bits of something, probably a list, in a convoluted way, eventually causing

[Tutor] interface with libreoffice calc spreadsheet to export pdf reports

2012-09-19 Thread Jim Smith Sr.
I have a spreadsheet with a named range "pdfReport" to export to pdf in the default location. The data changed based on student number input to another named range "_pid". Assumptions: the spreadsheet is already open and on the correct sheet. This doesn't matter, as we will be selecting the cel

[Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
loggs Player B: Nora Batty Player X: Jim Smith Player Y: Edna Jones A vs X: 3-0 B vs Y: 3-2 A vs Y: 3-0 B vs X: 3-2 Doubles: 3-1 >From this I can calculate the points allocated to teams and produce a table. I've not done any real python for about 6 years, but figured it'd be fun t

Re: [Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hullo, On Sat, May 30, 2015 at 3:49 PM, Laura Creighton wrote: > > 2. How do you receive your data now? Do you want to change this, > perhaps extend the capabilities -- i.e. let people send an sms > with results to your cell phone? Or limit the capabilities ("Stop > phoning me wit

[Tutor] Sorting a list of list

2015-06-05 Thread Stephen Nelson-Smith
As part of my league secretary program (to which thread I shall reply again shortly), I need to sort a list of lists. I've worked out that I can use sorted() and operator.itemgetter to sort by a value at a known position in each list. Is it possible to do this at a secondary level? So if the ite

[Tutor] tkinter window not showing max, min and close buttons

2015-07-20 Thread Chris Roy-Smith
orial? Thank you Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section on GUI. The windows that are created look odd with no title bar or maximise, minimise or close window button. The sim

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 21/07/15 21:52, Alan Gauld wrote: On 21/07/15 08:15, Chris Roy-Smith wrote: On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section on GUI. The windows that are created look odd

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 22/07/15 08:07, Chris Roy-Smith wrote: On 21/07/15 21:52, Alan Gauld wrote: On 21/07/15 08:15, Chris Roy-Smith wrote: On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section o

Re: [Tutor] Abs

2015-07-27 Thread Chris Roy-Smith
On 27/07/15 11:06, Job wrote: I want to be able to ask a user to input an integer and print out the root and power of the given integer. Why do you use abs(x) for this program? I don't understand or see the link between abs() and root and powers. This reminds me of this: By knowing that when

[Tutor] filtering listed directories

2015-08-22 Thread Chris Roy-Smith
Hi, environment: Python 2.7, Ubuntu 12.4 Linux I am trying to get the list of directories shown by tkFileDialog.askdirectory to not show hidden files (starting with .) this code results in lots of hidden directories listed in the interface making things harder than they need to be for the use

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 22/08/15 23:32, Alan Gauld wrote: On 22/08/15 11:43, Laura Creighton wrote: How can I filter out these hidden directories? Help(tkFileDialog) doesn't help me as it just shows **options, but doesn't show what these options might be. tix (tkinter extensions) https://wiki.python.org/moin/Tix

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 23/08/15 00:42, Laura Creighton wrote: In a message of Sat, 22 Aug 2015 14:32:56 +0100, Alan Gauld writes: But maybe some questions on a Tix (or Tk) forum might get more help? Once you know how to do it in native Tcl/Tk/Tix you can usually figure out how to do it in Python. -- Alan G I ask

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 23/08/15 18:13, Laura Creighton wrote: In a message of Sun, 23 Aug 2015 13:09:41 +1000, Chris Roy-Smith writes: On 22/08/15 23:32, Alan Gauld wrote: On 22/08/15 11:43, Laura Creighton wrote: How can I filter out these hidden directories? Help(tkFileDialog) doesn't help me as it just

Re: [Tutor] [Tkinter-discuss] tkinter file dialog pattern matching (fwd)

2015-08-24 Thread Chris Roy-Smith
On 23/08/15 23:52, Laura Creighton wrote: oooh. Seems that there is an undocumented feature we can use! Laura --- Forwarded Message Return-Path: Date: Sun, 23 Aug 2015 12:40:02 +0200 From: Michael Lange To: tkinter-disc...@python.org Message-Id: <20150823124002.7391f37e21f9b5cfaa917...@

[Tutor] Why does this function execute before being called?

2015-11-07 Thread Chris Roy-Smith
Hi, Environment: Python 2.7 Linux (Ubuntu 15.10) I am experiencing a problem with the code below running the "genF" function on opening the second window. I expected that function to be executed on clicking the 'fill text' button. The text widget gets filled on opening the window. This is my f

Re: [Tutor] Why does this function execute before being called?

2015-11-07 Thread Chris Roy-Smith
On 07/11/15 20:18, Alan Gauld wrote: On 07/11/15 04:34, Chris Roy-Smith wrote: def genF(ofield): ... for x in range(10): def second(): main=Toplevel(root) ofield=Text(main, height=15, width=15) ofield.pack() B3=Button(main, text='exit', command=main.destro

[Tutor] is there a better way to do this?

2016-05-09 Thread Chris Roy-Smith
ata[row][3]=lag data[row][4]=sleep row +=1 While I don't know a better way to do this, it seems a bit awkward, is there a better way? Thank you Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] is there a better way to do this?

2016-05-10 Thread Chris Roy-Smith
On 10/05/16 12:01, Steven D'Aprano wrote: On Mon, May 09, 2016 at 06:13:32PM +1000, Chris Roy-Smith wrote: data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs: data[row][0]=ddate data[row][1]=mood da

Re: [Tutor] is there a better way to do this?

2016-05-10 Thread Chris Roy-Smith
On 10/05/16 07:03, Ondřej Rusek wrote: Dne 9.5.2016 v 10:13 Chris Roy-Smith napsal(a): Hi Python 3.4 Linux (ubuntu) This code does what I want. curs is the result of a mysql query data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs:

[Tutor] Ideas for Child's Project

2015-01-06 Thread Stephen Nelson-Smith
Hello, My son is interested in programming, and has dabbled in Scratch and done a tiny bit of Python at school. He's 11 and is going for an entrance exam for a selective school in a couple of weeks. They've asked him to bring along something to demonstrate an interest, and present it to them. I

Re: [Tutor] Ideas for Child's Project

2015-01-07 Thread Stephen Nelson-Smith
Hi Danny, On Tue, Jan 6, 2015 at 10:07 PM, Danny Yoo wrote: > On Tue, Jan 6, 2015 at 1:46 PM, Stephen Nelson-Smith > wrote: > > You might want to look at Bootstrapworld, a curriculum for > middle-school/high-school math using programming and games: > > http://w

<    1   2   3   4   5   >