[Tutor] Error Using A List And SMTP

2012-05-16 Thread Sarma Tangirala
Hey guys, I was just trying out SMTP and I keep getting a attribute error, *AttributeError: 'list' object has no attribute 'lstrip''*, when I use a list to store the send address. Code - http://pastebin.com/9NmCNdRb Traceback - http://pastebin.com/m1cgKDnn I'm not sure I understand why this is

Re: [Tutor] Error Using A List And SMTP

2012-05-16 Thread Walter Prins
Hi Sarma On 16 May 2012 11:13, Sarma Tangirala wrote: > Hey guys, > > I was just trying out SMTP and I keep getting a attribute error, > *AttributeError: > 'list' object has no attribute 'lstrip''*, when I use a list to store the > send address. > > Code - http://pastebin.com/9NmCNdRb > > Trace

Re: [Tutor] table to dictionary and then analysis

2012-05-16 Thread Russel Winder
On Tue, 2012-05-15 at 19:14 +0100, Alan Gauld wrote: > On 15/05/12 10:36, Russel Winder wrote: > > ...queries passed over it then year a database it the > > right thing -- though I would probably choose a non-SQL database. > > As a matter of interest why? Because there are alternatives that need

Re: [Tutor] Error Using A List And SMTP

2012-05-16 Thread Sarma Tangirala
Hi Walter, > All the headers in the MimeText object needs to be strings. You can't > directly pass a list object containing multiple recipients to the "To" > header of your MimeText object on line 31 in your code, and expect it to > work. You've got to instead first convert the list to valid st

Re: [Tutor] Error Using A List And SMTP

2012-05-16 Thread Sarma Tangirala
On 16 May 2012 17:04, Sarma Tangirala wrote: > Hi Walter, > > >> All the headers in the MimeText object needs to be strings. You can't >> directly pass a list object containing multiple recipients to the "To" >> header of your MimeText object on line 31 in your code, and expect it to >> work. Y

Re: [Tutor] table to dictionary and then analysis

2012-05-16 Thread Alan Gauld
On 16/05/12 12:27, Russel Winder wrote: As a matter of interest why? Because there are alternatives that need to be investigated on a per problem basis for the best database. I agree, but in this case SQL seemed like the most likely fit of the ones I knew. however: SQL

Re: [Tutor] Error Using A List And SMTP

2012-05-16 Thread Alan Gauld
On 16/05/12 12:37, Sarma Tangirala wrote: But I do have another question. Maybe this is a misunderstanding about the MimeText type, but why does MimeText care about the To field when the actually sending is being done by SMTP? OK. That was a stupid question. Sorry for the noise. Pl

Re: [Tutor] Error Using A List And SMTP

2012-05-16 Thread Sarma Tangirala
On 16 May 2012 20:37, Alan Gauld wrote: > On 16/05/12 12:37, Sarma Tangirala wrote: > >>But I do have another question. Maybe this is a misunderstanding >>about the MimeText type, but why does MimeText care about the To >>field when the actually sending is being done by SMTP? >> > >

Re: [Tutor] table to dictionary and then analysis

2012-05-16 Thread Joel Goldstick
On Wed, May 16, 2012 at 11:03 AM, Alan Gauld wrote: > On 16/05/12 12:27, Russel Winder wrote: > >>> As a matter of interest why? >> >> >> Because there are alternatives that need to be investigated on a per >> problem basis for the best database. > > > I agree, but in this case SQL seemed like the

[Tutor] ssh socks proxy

2012-05-16 Thread Adam Gold
I'm trying to write a 'simple' script that will set up a socks proxy over ssh and maintain the connection until manually terminated. It's not possible to use key-based authentication so a password will need to be supplied. Also, note, the user is presented with a list of servers to choose fro

[Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Greg Christian
Can anyone tell me what I am doing wrong here. When trying to call the factors function from main with x = factors(Tn), getting the error message: “TypeError: 'int' object is not callable”? Any help would be appreciated. Thanks. def factors(n): L = [] for i in range(1, int(n ** 0.5) + 1

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Modulok
On 5/16/12, Greg Christian wrote: > Can anyone tell me what I am doing wrong here. When trying to call the > factors function from main with x = factors(Tn), getting the error message: > “TypeError: 'int' object is not callable”? Any help would be appreciated. > Thanks. > > > def factors(n): >

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Emile van Sebille
On 5/16/2012 1:17 PM Greg Christian said... def factors(n): L = [] for i in range(1, int(n ** 0.5) + 1): if (n % i == 0): L.append(i) return L ... now you've completed defining the function factors... def main(): factors = 0 ... and here you create

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread René Bastian
Le Wed, 16 May 2012 14:37:53 -0600, Modulok a écrit : > On 5/16/12, Greg Christian wrote: > > Can anyone tell me what I am doing wrong here. When trying to call > > the factors function from main with x = factors(Tn), getting the > > error message: “TypeError: 'int' object is not callable”? Any

Re: [Tutor] ssh socks proxy

2012-05-16 Thread kushal . kumaran+python
Adam Gold wrote: >I'm trying to write a 'simple' script that will set up a socks proxy >over ssh and maintain the connection until manually terminated. It's >not possible to use key-based authentication so a password will need to >be supplied. Also, note, the user is presented with a list of s

Re: [Tutor] ssh socks proxy

2012-05-16 Thread kushal . kumaran+python
kushal.kumaran+pyt...@gmail.com wrote: >Adam Gold wrote: > >>I'm trying to write a 'simple' script that will set up a socks proxy >>over ssh and maintain the connection until manually terminated. It's >>not possible to use key-based authentication so a password will need >to >>be supplied. Als