Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Walter Prins
Hi Jim, On 8 July 2014 21:45, Jim Byrnes wrote: > I would like to automate running virtualenv with a python script by: > > opening gnome-terminal > cd to proper directory > run source /bin/activate > > I found some examples of using os.system() to get gnome-terminal to open > but I can't figure

Re: [Tutor] A beginner having problems with inheritance

2014-07-09 Thread Sydney Shall
On 06/07/2014 23:06, Danny Yoo wrote: My apologies to the tutors. I have identified my error, which was predictably elementary. With many thanks, By the way, can you say what your conceptual error was or give an example? It might help the other folks here who are learning and who may be making

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Jim Byrnes
On 07/09/2014 04:27 AM, Walter Prins wrote: Hi Jim, On 8 July 2014 21:45, Jim Byrnes wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate I found some examples of using os.system() to get gnome-ter

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Jim Byrnes
On 07/08/2014 06:39 PM, Alan Gauld wrote: On 08/07/14 21:45, Jim Byrnes wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate Thats almost certainly the wrong approach. Instead of trying to automate w

[Tutor] How does this work (iterating over a function)?

2014-07-09 Thread steve10brink
Greetings, I've been learning Python concepts for about 6 months now and was doing okay with most of these. However, I ran into a fairly simple program developed by Mark Pilgrim in his "Dive Into Python" text that puzzles me and am hoping some of you can explain how this works. He is creating

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Raúl Cumplido
Hi, Let's see what happens iteration by iteration. First iteration: def fibonacci(max): #using a generator > a, b = 0, 1 > # The value of a is 0 and b is 1, easy :) > while a < max: > yield a > # yield a (0) (yield is a keyword that is used like return but returns a generator).

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Raúl Cumplido
Hi, A little bit more on this :) Python iterator protocol will call the next() method on the iterator on each iteration and receive the values from your iterator until a StopIteration Exception is raised. This is how the for clause knows to iterate. In your example below you can see this with the

Re: [Tutor] Tkinter resizable menu??

2014-07-09 Thread Albert-Jan Roskam
  - Original Message - > From: Alan Gauld > To: tutor@python.org > Cc: > Sent: Tuesday, July 8, 2014 8:56 PM > Subject: Re: [Tutor] Tkinter resizable menu?? > > On 08/07/14 16:46, Albert-Jan Roskam wrote: >> I pasted the code here because it is a bit much (sorry): > > Too much for me,

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Deb Wyatt
> > Greetings, > > > I've been learning Python concepts for about 6 months now and was doing > okay with most of these. However, I ran into a fairly simple program > developed by Mark Pilgrim in his "Dive Into Python" text that puzzles me > and am hoping some of you can explain how this works.

Re: [Tutor] Tkinter resizable menu??

2014-07-09 Thread Alan Gauld
On 09/07/14 16:54, Albert-Jan Roskam wrote: The Tix module has a scrollable listbox widget which is quite easy to use and does all that stuff for you. Ahh, I will certainly look into that. Today > somebody recommanded Python Megawidgets to me The PMW are fine too but Tix comes as part of the

Re: [Tutor] A beginner having problems with inheritance

2014-07-09 Thread Danny Yoo
> My error was simply that I inadvertently used the same name for a method > (function) in the derived class that I had already used in the parent class. > The result was then a very obscure error because the wrong calculation was > performed and later on an array was empty. > Fortunately, thanks t

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread steve10brink
ido -- next part -- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/tutor/attachments/20140709/ccbbee12/attachment-0001.html> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Raúl Cumplido
next() > Traceback (most recent call last): > File "", line 1, in > StopIteration > >>> > > Thanks, > Ra?l > > > > > > -- > Ra?l Cumplido > -- next part -- > An HTML attachment was scrubbed... > URL: &

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Danny Yoo
By the way, it may be really instructive to read the article when generators were officially introduced into Python 2.2: https://docs.python.org/3/whatsnew/2.2.html#pep-255-simple-generators It's written for the perspective of someone who doesn't know what generators are. Because of that, it

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Danny Yoo
It might also be useful to see what an equivalent version of that fib() iterator looks like if we don't take advantage of generators ourselves. Here's an attempt at it: ### def fib1(max): a, b, = 0, 1 while a < max: yield a a, b,

Re: [Tutor] Unpacking lists

2014-07-09 Thread Wolfgang Maier
On 09.07.2014 08:16, Alan Gauld wrote: On 09/07/14 06:58, Alan Gauld wrote: list1 = [1, 8, 15] list2 = [2, 9, 16] list3 = [[3, 4, 5, 6], [10, 11, 12, 13], [17, 18, 19, 20]] list4 = [7, 14, 21] I'm thinking something like result = [] for L in (list1,list2,list3): if isinstance(L,list)

[Tutor] How to Create Webpage with Python

2014-07-09 Thread John Cast
First, please forgive any ignorance in my post here as I am not good with HTML and new to python. I have a bunch of excel spreadsheets (all in the same format) that I am writing a python script to go through and pick out some information and post to a wiki page. I'm new to python and have gone thr

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Walter Prins
Hi Jim, On 9 July 2014 14:43, Jim Byrnes wrote: > On 07/09/2014 04:27 AM, Walter Prins wrote: > >> I forgot to mention I am using Linux (Ubuntu 12.04). >> > > I am working my way through a book about breezypythongui which uses Python > 3, hence virtualenv. I found that each time I started to wo

Re: [Tutor] How to Create Webpage with Python

2014-07-09 Thread Walter Prins
Hi John, Welcome you to the Python tutor mailing list. On 9 July 2014 19:26, John Cast wrote: > > First, please forgive any ignorance in my post here as I am not good with > HTML and new to python. Not a problem. Although the list if formally about learning the basics of Python, there's many

Re: [Tutor] How to Create Webpage with Python

2014-07-09 Thread Alan Gauld
On 09/07/14 19:26, John Cast wrote: I have a bunch of excel spreadsheets (all in the same format) that I am writing a python script to go through and pick out some information and post to a wiki page. I'm new to python and have gone through some basic tutorials. I feel confident that I can figur

Re: [Tutor] How to Create Webpage with Python

2014-07-09 Thread Mark Lawrence
On 09/07/2014 19:26, John Cast wrote: First, please forgive any ignorance in my post here as I am not good with HTML and new to python. I have a bunch of excel spreadsheets (all in the same format) that I am writing a python script to go through and pick out some information and post to a wiki p

[Tutor] Off topic - Ruby similar list?

2014-07-09 Thread Mike Nickey
Just curious if there's a similar list like this one for Ruby-ists. Anyone know of one or two? TIA -- ~MEN ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Off topic - Ruby similar list?

2014-07-09 Thread Danny Yoo
On Wed, Jul 9, 2014 at 3:40 PM, Mike Nickey wrote: > Just curious if there's a similar list like this one for Ruby-ists. > Anyone know of one or two? Hi Mike, I believe the general ruby-talk mailing list is what you're looking for. See: https://www.ruby-lang.org/en/community/mailing-lists

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Cameron Simpson
On 09Jul2014 09:00, Jim Byrnes wrote: My mistake. I went to the Docs page and clicked on modules and then os. For some reason as I was scrolling down the page I thought the subject had changed and stopped reading. Now I see I stopped reading to soon as it is much further down the page. Wh

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-09 Thread Cameron Simpson
On 09Jul2014 22:16, Walter Prins wrote: On 9 July 2014 14:43, Jim Byrnes wrote: On 07/09/2014 04:27 AM, Walter Prins wrote: I forgot to mention I am using Linux (Ubuntu 12.04). I am working my way through a book about breezypythongui which uses Python 3, hence virtualenv. I found that each

Re: [Tutor] How does this work (iterating over a function)?

2014-07-09 Thread Cameron Simpson
On 09Jul2014 15:00, steve10br...@comcast.net wrote: I've been learning Python concepts for about 6 months now and was doing okay with most of these. However, I ran into a fairly simple program developed by Mark Pilgrim in his "Dive Into Python" text that puzzles me and am hoping some of you ca

[Tutor] plz find error

2014-07-09 Thread Mandar Dhadve
#!/usr/bin/env python import socket,sys from impacket import ImpactDecoder, ImpactPacket src = sys.argv[1] dst = sys.argv[2] #Create a new IP packet and set its source and destination addresses ip = ImpactPacket.IP() ip.set_ip_src(src) ip.set_ip_dst(dst) #Create a new ICMP packet icmp = Impac

Re: [Tutor] How to Create Webpage with Python

2014-07-09 Thread John Cast
Thanks everyone for the tremendous and speedy support! Here's a bit more information that I think would be useful: I will be hosting this (for the foreseeable future at least) on my desktop. There is another python script already written that generates the excel spreadsheets (I did not write this