Re: [Tutor] ssh script

2008-01-24 Thread washakie
Thanks everyone these seem like promising directions to go... Eric, any chance you could share your 'similar' code? The problem it seems with paramiko is that it has little 'newbie' documentation, and I'm not clear how to set up the reverse port forwarding on it. Thus I may need to use the pexpect

[Tutor] Comparing more than 2 lists

2008-01-24 Thread Fiyawerx
I have been able to find a few articles on comparing 2 lists, but I have 4 lists that I need to compare. I need to find any repeated elements and the list that they came from. For example, list1 = ['one', 'two', 'three'] list2 = ['one', 'two', 'four', 'five'] list3 = ['two', 'three', 'six', 'seven

Re: [Tutor] Comparing more than 2 lists

2008-01-24 Thread Michael Langford
You use a variation on bucket sort do to this: http://en.wikipedia.org/wiki/Bucket_sort You make a dict where the keys are the values in the lists, and a name for each list is in the problem. So you get something that looks like: one: list1, list2 two: list1, list2, list3 etc Doing this with co

[Tutor] creating a nested dictionary

2008-01-24 Thread Garry Willgoose
Is there any easy way to create a nested dictionary. I want to be able to allocate like pdb[dataset][modulename][parametername]['value']=value where dataset, modulename, parametername are variables that are determined within loops nested 3 deep, and value comes from a database call. Prior t

Re: [Tutor] creating a nested dictionary

2008-01-24 Thread Remco Gerlich
Hi, Stream of consciousness answer: So, you want to set things in a dictionary with a statement like d[a][b][c][d] = x, even though d[a] wasn't used before so it's not initialized yet (let alone d[a][b]). Of course, if d is a dict, the d[a] = x works. That's one level deep, and non existing key

Re: [Tutor] creating a nested dictionary

2008-01-24 Thread Remco Gerlich
Of course, I forgot to mention that you can use tuples as dictionary keys. A common idiom is: pdb[(dataset, modulename, parametername, 'value')] = value. And if that works for you, it's much simpler. But you lose the ability to use, say, pdb[dataset][modulename] as a dictionary on its own. Remc

Re: [Tutor] Comparing more than 2 lists

2008-01-24 Thread Fiyawerx
Thanks Michael, this worked great, time to read up on collections! On Jan 24, 2008 3:36 AM, Michael Langford <[EMAIL PROTECTED]> wrote: > You use a variation on bucket sort do to this: > http://en.wikipedia.org/wiki/Bucket_sort > > You make a dict where the keys are the values in the lists, and a

[Tutor] lst file

2008-01-24 Thread SwartMumba snake
Hi I am trying to read from a specific .lst file. When I read from it, it just prints out blank lines and I am sure that this file contains content. This is what I am using to read from the file: f = open("C:\\Users\\UserName\\Directory\\words.lst") for line in f: print line f.close() D

Re: [Tutor] lst file

2008-01-24 Thread Remco Gerlich
Many things could be wrong; perhaps with reading the file, or the lines, or with printing them... Debugging usually consists of what the problem is exactly, where it occurs. First thing I'd look at is seeing whether the lines do get read. I would change "print line" into "print len(line)" and see

Re: [Tutor] MySQLdb for Python 2.5? (Debian related)

2008-01-24 Thread tetsuo2k6
Michael Langford schrieb: >> However, Debian is known for stability and security, right? I don't know >> if I should install things without apt in a production environment, so I >> first have to ask my guru if it's alright. > > The *point* of buildout is that the entire installation is *local* to

Re: [Tutor] [ctypes-users] calls to windll.user32

2008-01-24 Thread Tiger12506
> Something like this happens with Pygame and IDLE. In Windows if you > right click on a Python file and choose the "Edit with IDLE" option IDLE > is started with a single process. If the program is run and it does its > own windowing then it conflicts with Tkinter, used by IDLE. Start IDLE

Re: [Tutor] creating a nested dictionary

2008-01-24 Thread Kent Johnson
Remco Gerlich wrote: > I can't think of a really good generalization, one that will work for > all depths. That's the sort of thing you use Lisp, combinators and lots > of coffee for. Perhaps later today. Some nice solutions here: http://groups.google.com/group/comp.lang.python/browse_thread/thr

Re: [Tutor] TypeError in base class __init__ after reload

2008-01-24 Thread Kent Johnson
Oops, sending to the list with this PS: Google 'python reload' for discussion and workarounds. Daniel Knierim wrote: > Hello Pythonistas, > > Running the script 'instantiate_and_reload.py' gives me the error > TypeError: unbound method __init__() must be called with ParentClass > instance a

[Tutor] printing format with list

2008-01-24 Thread Andy Cheesman
Hi people Is there a way to use a list with printf formating without having to explicitly expanding the list after the % e.g a = [1, 2, 3] print """ Testing %i, %i, %i """ %(a[0], a[1], a[2]) Cheers Andy ___ Tutor maillist - Tut

Re: [Tutor] printing format with list

2008-01-24 Thread Tim Golden
Andy Cheesman wrote: > Hi people > > Is there a way to use a list with printf formating without having to > explicitly expanding the list after the % > > e.g > > a = [1, 2, 3] > > print """ Testing > %i, %i, %i """ %(a[0], a[1], a[2]) > It looks as though string formatting on

Re: [Tutor] printing format with list

2008-01-24 Thread Kent Johnson
Andy Cheesman wrote: > Hi people > > Is there a way to use a list with printf formating without having to > explicitly expanding the list after the % > > e.g > > a = [1, 2, 3] > > print """ Testing > %i, %i, %i """ %(a[0], a[1], a[2]) The argument after % must be a tuple (or a

Re: [Tutor] Tutor Digest, Vol 47, Issue 64

2008-01-24 Thread prdo22002
on) >> FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal >> and Telluric) >> Env. Engg. Secretary: (International) +61 2 4921 6042 >> >> email: [EMAIL PROTECTED]; >> [EMAIL PROTECTED] >> email-for-life: [EMAIL PROTECTED] >> persona

Re: [Tutor] Tutor Digest, Vol 47, Issue 64

2008-01-24 Thread bob gailer
[EMAIL PROTECTED] wrote: > Stop sending your mails > > Send Tutor mailing list submissions to > >> tutor@python.org >> Did you notice the instructions that appeared at the top of what you just sent? Only you can manage your subscription. >> To subscribe or unsubscribe via the World

[Tutor] (no subject)

2008-01-24 Thread sigurt dinesen
Hi i have been fooling around in python a bit and looked at a couple of tutorials, but something i wonder about: is it posible to make python make an output in a windows "tekstbox" for instance to make several adjustments to my network settings at once, by running a python program and if it is,

Re: [Tutor] Projects (fwd)

2008-01-24 Thread Ricardo Aráoz
Tiger12506 wrote: >> Isn't dictionary access faster than list access? Why are three lists >> 'much more efficient'? > > Oh no, no, no. Dictionaries are faster when you are *searching through* for > a particular value. If you already know the index of the item in the list, > lists are much faste

Re: [Tutor] lst file

2008-01-24 Thread Alan Gauld
"SwartMumba snake" <[EMAIL PROTECTED]> wrote > I am trying to read from a specific .lst file. When I read from it, > it just prints out blank lines and I am sure that this file contains > content. Wjat kind of content? Have you opened it in a text editor and looked at it? You are reading the fi

Re: [Tutor] ssh script

2008-01-24 Thread Eric Walstad
Hi Washake, Here's a sample I just whipped up from the example I found here: Note that I had to tweak the 'tunnel_command' line a bit as it was missing the conversion type. This sets

Re: [Tutor] Comparing more than 2 lists

2008-01-24 Thread Alan Gauld
"Fiyawerx" <[EMAIL PROTECTED]> wrote > list1 = ['one', 'two', 'three'] > list2 = ['one', 'two', 'four', 'five'] > list3 = ['two', 'three', 'six', 'seven'] > list4 = ['three', 'five', 'six'] > > I need to be able to get along the lines of output: > Element 'one' contained in list1 and list2 > El

[Tutor] Dos and os.walk with Python

2008-01-24 Thread Timothy Sikes
Hi.I wrote a python script that goes through a specified directory and returns a list of all the files that haven't been modified since a certain date. I was hoping to be able to then continue with the program to bring up dos, and zip, then move the files (to my external hard drive). I have

[Tutor] Forgot something...

2008-01-24 Thread Timothy Sikes
Sorry, but in my previous message, I realized that I hadn't changed the code from doesNotHave... It's supposed to be x.find(), not x.startswith..Oh, and I also am not worried about messing up any files too much, because I have them all backed up on another computer already _

Re: [Tutor] Dos and os.walk with Python

2008-01-24 Thread Alan Gauld
"Timothy Sikes" <[EMAIL PROTECTED]> wrote > I don't know if it's okay to ask about Dos in python mailing list, If its related to programming in python as well its fine :-) > I don't know if there are any formatting rules for posting programs It helps if we can see the formatting, especially s

Re: [Tutor] Dos and os.walk with Python

2008-01-24 Thread Timothy Sikes
I'm getting the "Digest" version of the mailing list, if there's any better way to respond to a specific message, I would like to know. thanks :> > From: [EMAIL PROTECTED]> Subject: Tutor Digest, Vol 47, Issue 66> To: > tutor@python.org> Date: Fri, 25 Jan 2008 02:09:13 +0100> > >

[Tutor] Error connecting to MySQL from Python script

2008-01-24 Thread Kamal
I have the MySQL Server (5.0.51) running on Windows XP machine, when I try to connect to this server with a Python script, it gives the below error. Wondering why is it happening? _mysql_exceptions.Operational Error: (1251, 'Client does not support authentication protocol requested by server; cons

Re: [Tutor] Dos and os.walk with Python

2008-01-24 Thread Marc Tompkins
On Jan 24, 2008 5:28 PM, Timothy Sikes <[EMAIL PROTECTED]> wrote: > I'm getting the "Digest" version of the mailing list, if there's any > better way to respond to a specific message, I would like to know. thanks :> > I also originally signed up for the digest - it drove me up the wall, so I subs

Re: [Tutor] Projects (fwd)

2008-01-24 Thread Tiger12506
> Nope, if you read the code you'll see the only mapping done is up to 20 > and then by tens up to 100, that's all. > The same code could be used with a list, you'd only have to change the > exception name. I see. There were "..." in between each of the tens entries which I took to mean that "big

Re: [Tutor] (no subject)

2008-01-24 Thread Tiger12506
>Hi >i have been fooling around in python a bit and looked at a couple of >tutorials, but something i >wonder about: is it posible to make python make >an output in a windows "tekstbox" for >instance to make several adjustments >to my network settings at once, by running a python >program >and i

Re: [Tutor] Dos and os.walk with Python

2008-01-24 Thread Tiger12506
>> I've had little experience with dos. I believe I should use the >> COMPACT, and then the MOVE dos command... Would >> it go something like this? > > You could use these but you'd be better just using Python > to do it via the shutil and os modules and avoid the DOS > commands completely IMHO.

[Tutor] setstate trouble when unpickling

2008-01-24 Thread Jeff Peery
Hello, I've got a fairly simple class instance that I'm pickling. I'm using setstate to update the instance when I unpickle. Although the setstate doesn't seem to be called upon unpickling... here's an example, if anyone see's what I'm doing wrong, please let me know. Thanks! so I sa

Re: [Tutor] Dos and os.walk with Python

2008-01-24 Thread Alan Gauld
"Timothy Sikes" <[EMAIL PROTECTED]> wrote > I'm getting the "Digest" version of the mailing list, > if there's any better way to respond to a specific message, > I would like to know. thanks :> I used to use the digest before switching to the gmane news feed. I seem to recall there are two d