Re: [Tutor] A couple newbie questions about Python

2014-06-11 Thread Lukáš Němec
Hi, responses below... Dne 11. 6. 2014 22:46, Deb Wyatt napsal(a): Hi. Everywhere I have read, the 'standard practice' for indentation is 4 spaces, but I am running into 2 space indentation in a lot of tutorials and such. Should I keep with the 4 spaces, or does it even matter, as long as it

Re: [Tutor] A couple newbie questions about Python

2014-06-11 Thread Alex Kleider
On 2014-06-11 20:08, Dave Angel wrote: I learned programming in 1967 with Fortran, and McCracken spent a chapter warning about that same thing. Probably everything he warned about still applies to Python and modern computers. A google search for "McCracken" did not yield anyone that seems

Re: [Tutor] A couple newbie questions about Python

2014-06-11 Thread Steven D'Aprano
Hi Deb, My responses below, interleaved with your questions. On Wed, Jun 11, 2014 at 12:46:11PM -0800, Deb Wyatt wrote: > Hi. Everywhere I have read, the 'standard practice' for indentation > is 4 spaces, but I am running into 2 space indentation in a lot of > tutorials and such. Should I k

Re: [Tutor] A couple newbie questions about Python

2014-06-11 Thread Dave Angel
Deb Wyatt Wrote in message: > Hi. Everywhere I have read, the 'standard practice' for indentation is 4 > spaces, but I am running into 2 space indentation in a lot of tutorials and > such. Should I keep with the 4 spaces, or does it even matter, as long as it > is consistent? > 4 spaces is

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 11:43, Adam Gold wrote: # create snapshot names like the following: 2014-06-10T01-00-01.vm1.img.bz2 for i in vgxenList: DATE = datetime.datetime.now().strftime("%Y-%m-%d" + "T" + "%H-%M-%S") Why use addition? You could just insett the literal T... DATE = datetime.datetime.now

Re: [Tutor] A couple newbie questions about Python

2014-06-11 Thread Alan Gauld
On 11/06/14 21:46, Deb Wyatt wrote: Hi. Everywhere I have read, the 'standard practice' for indentation is 4 spaces, That's a style recommendation. Python doesn't care. But your readers will. 2 spaces is the absolute minimum, 8 spaces is about the absolute maximum. Outside that it gets hard t

[Tutor] A couple newbie questions about Python

2014-06-11 Thread Deb Wyatt
Hi. Everywhere I have read, the 'standard practice' for indentation is 4 spaces, but I am running into 2 space indentation in a lot of tutorials and such. Should I keep with the 4 spaces, or does it even matter, as long as it is consistent? I just recently became aware of the inaccuracy of ca

Re: [Tutor] code review

2014-06-11 Thread Lukáš Němec
Ok, not so bad, hoewer there are some parts of the code that could be done a bit cleaner. I'll write them below in the response. Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time av

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
>>> Thanks for the reply Steven. It's no more than 100 lines at a >>> guess > >> In that case just copy and paste it into a message and send it to >> the group. Anyone with time available can then take a peek. > > One way noobs anywhere can learn is by listening in to other people's > conversati

Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Thank you for your help, this definitely gets me going in the right direction! On Wed, Jun 11, 2014 at 4:16 AM, Marc Tompkins wrote: > On Tue, Jun 10, 2014 at 4:08 PM, Jon Engle wrote: > > Ok, so when I run the code it immediately terminates and never 'listens' > to > > the ports in the loop.

Re: [Tutor] [OT] Long delay until my posts appear

2014-06-11 Thread Alan Gauld
On 11/06/14 09:49, Peter Otten wrote: Something has changed on the list server which means that any time someone edits their settings it automatically sets up full moderation. Normal service should have resumed. It has! Thank you. Good, now if only I could find a way to stop the server switc

Re: [Tutor] python sockets

2014-06-11 Thread Peter Otten
Alan Gauld wrote: > On 11/06/14 00:08, Jon Engle wrote: >> Ok, so when I run the code it immediately terminates and never 'listens' > > This has nothing to do with your immediate problem but... > >> ***Code*** >> >>#!/usr/bin/python # This is server.py file >> from socket impo

Re: [Tutor] [OT] Long delay until my posts appear

2014-06-11 Thread Peter Otten
Alan Gauld wrote: > On 10/06/14 09:43, Peter Otten wrote: >> I'm posting via gmane. Since last month there is a delay (usually a few >> hours I think) until my posts appear and I seem to be getting a >> >> "Your message to Tutor awaits moderator approval, would you like to >> cancel..." > > Somet

Re: [Tutor] python sockets

2014-06-11 Thread Peter Otten
Jon Engle wrote: > Ok, so when I run the code it immediately terminates and never 'listens' > to the ports in the loop. I have verified by running netstat -an | grep > 65530 and the startingPort is not binding. As I've already hinted the easiest way to keep your listening threads alive is to use

Re: [Tutor] code review

2014-06-11 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/06/14 08:11, Alan Gauld wrote: > On 11/06/14 00:30, Adam Gold wrote: > >> Thanks for the reply Steven. It's no more than 100 lines at a >> guess > > In that case just copy and paste it into a message and send it to > the group. Anyone with tim

Re: [Tutor] python sockets

2014-06-11 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 4:08 PM, Jon Engle wrote: > Ok, so when I run the code it immediately terminates and never 'listens' to > the ports in the loop. I have verified by running netstat -an | grep 65530 > and the startingPort is not binding. The problem is that all threads started by a program

Re: [Tutor] python sockets

2014-06-11 Thread Alan Gauld
On 11/06/14 00:08, Jon Engle wrote: Ok, so when I run the code it immediately terminates and never 'listens' This has nothing to do with your immediate problem but... ***Code*** #!/usr/bin/python # This is server.py file from socket import * #import the socket library

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 00:30, Adam Gold wrote: Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time available can then take a peek. hth -- Alan G Author of the Learn to Program web site http:

Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Ok, so when I run the code it immediately terminates and never 'listens' to the ports in the loop. I have verified by running netstat -an | grep 65530 and the startingPort is not binding. ***Server*** Jons-Mac:Desktop Jon$ python response.py Please enter starting port: 65530 Jons-Mac:Desktop Jo

Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Ok, so after making the changes the code does bind the startingPort variable but that is the only port that gets bound. Also when connecting to the startingPort I receive the following error: Please enter starting port: 65520 listening... ...connected! Traceback (most recent cal

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
On 11/06/14 00:04, Steven D'Aprano wrote: > On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: >> Hi there. I've been writing a script that is now finished and working >> (thanks, in part, to some helpful input from this board). What I'd >> really like to do now is go through it with an '