[Tutor] buck newbie

Michael A. Peters mpeters@mac.com
Fri, 24 May 2002 21:30:05 -0700


Howdie all-

I'll be coding my first python script.
It's to perform a simple function, but I'd be eager to look at any code
that does a similar thing.

Basically, upon launch it is to attempt to download a txt file off the
net.
If fail, it should retry every 10 minutes for 5 hors 50 minutes.

I assume an idle or sleep statement can accomplish that- basically, until
success or time = blah do

Anyway- the meet of the app is that (assuming it gets the text file) it
needs to read each line of the text file and extract the reletaive info
(it's tab deliminated to something equivalent to the unix command cut will
suffice) and then feed the info into a MySQL database.

there are two fields- a username and a team number.
They are not unique in the database, but there is only one username
associated with each team.
So when it has the username and team, it needs to find the unique
identifier associated with that unique pairing.

If the unique pairing does not exist, it needs to add a row to the
database and then return the unique identifier (auto increment) that is
now associated with the pair.

Then with that unique key- insert the data into the database.

ANYWAY- I would love some pointers to some code demonstrating how to use
MySQL with Python.
I have Python 2.2.1 and the  MySQL-python-0.9.2b2 package installed.

I also have a couple good books on Python- but they don't cover database
connectivity.

Thanks for any help!