[Tutor] Borg di borg di borg (or: Swedish chef)

2012-09-24 Thread Albert-Jan Roskam
Hi Pythonistas, I have three classes, Generic, Test and Test2. Generic contains a load method that loads a file. This may only be done once, as a file_read_open error is returned if the file is open already and an attempt is made to re-open it. The file may be opened from Test or Test2. After a

Re: [Tutor] Borg di borg di borg (or: Swedish chef)

2012-09-24 Thread Peter Otten
Albert-Jan Roskam wrote: > Hi Pythonistas, > > I have three classes, Generic, Test and Test2. Generic contains a load > method that loads a file. This may only be done once, as a file_read_open > error is returned if the file is open already and an attempt is made to > re-open it. The file may be

[Tutor] running program in terminal

2012-09-24 Thread Benjamin Fishbein
Hello. I can run programs in IDLE but when I try to do it in a terminal or with textwrangler, it usually just logs out and says it's completed, but the program hasn't been run. This is particularly so when the program uses urllib. I'm using OS X. logout [Process completed] That's what it pri

Re: [Tutor] Sudoku

2012-09-24 Thread Walter Prins
Mark, On 23 September 2012 22:53, Mark Lawrence wrote: >> Is the personal sniping really necessary? (That's a rhetorical >> question, just to be clear.) > > Well if Dwight insists on replying to something without quoting the context > so the rest of us haven't the faintest idea what he's talking

Re: [Tutor] Borg di borg di borg (or: Swedish chef)

2012-09-24 Thread eryksun
On Mon, Sep 24, 2012 at 6:02 AM, Albert-Jan Roskam wrote: > > I have three classes, Generic, Test and Test2. Generic contains a load > method that loads a file. This may only be done once, as a > file_read_open error is returned if the file is open already and an > attempt is made to re-open it. T

Re: [Tutor] running program in terminal

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 17:41, Benjamin Fishbein wrote: > Hello. I can run programs in IDLE but when I try to do it in a terminal or > with textwrangler, it usually just logs out and says it's completed, but > the program hasn't been run. This is particularly so when the program uses > urllib. I'm u

Re: [Tutor] Sudoku

2012-09-24 Thread Mark Lawrence
On 24/09/2012 17:52, Walter Prins wrote: Mark, On 23 September 2012 22:53, Mark Lawrence wrote: Is the personal sniping really necessary? (That's a rhetorical question, just to be clear.) Well if Dwight insists on replying to something without quoting the context so the rest of us haven't t

[Tutor] BMI Question

2012-09-24 Thread Aija Thompson
Hi! So I've been working on this question for hours! And Python keeps giving me an error saying that my syntax for BMI is wrong. I really can't understand why. So this is what I have so far: w = raw_input('Please give your weight in lbs: ')h = raw_input('Now your height in feet and inches: ')h.

Re: [Tutor] Sudoku

2012-09-24 Thread Aija Thompson
I'm sorry, I have no idea how this has any reference to my Python question... > To: tutor@python.org > From: breamore...@yahoo.co.uk > Date: Mon, 24 Sep 2012 20:16:39 +0100 > Subject: Re: [Tutor] Sudoku > > On 24/09/2012 17:52, Walter Prins wrote: > > Mark, > > > > On 23 September 2012 22:53, Ma

Re: [Tutor] BMI Question

2012-09-24 Thread Stephen Haywood
On Sep 24, 2012, at 3:16 PM, Aija Thompson wrote: Hi! So I've been working on this question for hours! And Python keeps giving me an error saying that my syntax for BMI is wrong. I really can't understand why. So this is what I have so far: w = raw_input('Please give your weight in lbs: ') h

[Tutor] Python Assignment Question

2012-09-24 Thread Aija Thompson
Hi! I've been working on this question for a long time and for some reason it's just not clicking. I'm not sure if my loop for the question is the right one, or if I'm even on the right track. We're supposed to make a program that counts the number of days into the year it is if you input a d

Re: [Tutor] Sudoku

2012-09-24 Thread Mark Lawrence
On 24/09/2012 20:15, Aija Thompson wrote: I'm sorry, I have no idea how this has any reference to my Python question... Please accept my apologies for getting completely off topic on your thread. -- Cheers. Mark Lawrence. ___ Tutor maillist - T

Re: [Tutor] BMI Question

2012-09-24 Thread eryksun
On Mon, Sep 24, 2012 at 3:13 PM, Aija Thompson wrote: > > ft, inches = h. split("'") > h_sum = float(12*int(ft)) + (int(inches.strip('"')) Leave h_sum as an int: h_sum = 12 * int(ft) + int(inches.strip('"')) A better name here would be "h_inch". Also, make sure your parentheses are closed.

Re: [Tutor] BMI Question

2012-09-24 Thread Prasad, Ramit
Aija Thompson wrote: > Hi! > > So I've been working on this question for hours! And Python keeps giving me an > error saying that my syntax for BMI is wrong. I really can't understand why. > > So this is what I have so far: One suggestion: immediately convert to appropriate number type instead

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Mark Lawrence
On 24/09/2012 20:20, Aija Thompson wrote: Hi! I've been working on this question for a long time and for some reason it's just not clicking. I'm not sure if my loop for the question is the right one, or if I'm even on the right track. We're supposed to make a program that counts the number of

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Dwight Hutto
On Mon, Sep 24, 2012 at 3:20 PM, Aija Thompson wrote: > Hi! > > I've been working on this question for a long time and for some reason it's > just not clicking. Algorithm is the appropriate approach. That's what makes it click. > > I'm not sure if my loop for the question is the right one, or if

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Dwight Hutto
On Mon, Sep 24, 2012 at 4:24 PM, Dwight Hutto wrote: > On Mon, Sep 24, 2012 at 3:20 PM, Aija Thompson > wrote: >> Hi! >> >> I've been working on this question for a long time and for some reason it's >> just not clicking. > > Algorithm is the appropriate approach. That's what makes it click. > >

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Prasad, Ramit
Aija Thompson wrote: > Hi! > > I've been working on this question for a long time and for some reason it's > just not clicking. > > I'm not sure if my loop for the question is the right one, or if I'm even on > the right track. > > We're supposed to make a program that counts the number of days

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Dave Angel
On 09/24/2012 03:20 PM, Aija Thompson wrote: > Hi! > I've been working on this question for a long time and for some reason it's > just not clicking. > I'm not sure if my loop for the question is the right one, or if I'm even on > the right track. > We're supposed to make a program that counts

Re: [Tutor] Sudoku

2012-09-24 Thread Dwight Hutto
Dwight, Please stop responding to Mark. His behaviour is typical schoolyard bully, meaning he's saying things precisely because he gets a reaction from you. He probably doesn't even realise that he's doing it consciously, but either way the best way to deal with such behaviour is to stop giving

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Aija Thompson
Hi, Yeah this is my first assignment and I've never worked on anything programming before. I am working in Python 2.7 The shorter and longer months thing is just a not to myself, that is why it has the hash tag before he sentence. But my initial plan was to make a string of months and a string o

Re: [Tutor] Python Assignment Question

2012-09-24 Thread Dave Angel
On 09/24/2012 04:56 PM, Aija Thompson wrote: > > Hi, By top-posting, you lose all the context. The convention is to quote those parts of the previous messages necessary to understand the context, and then add your own remarks immediately after the appropriate parts. > Yeah this is my first ass

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Gregory Lund
>> but now get a " x = zipfile.Zipfile(item,'r') >> AttributeError: 'module' object has no attribute 'Zipfile' " >> >> error >> >> gr, this is going to send me to the funny farm! >> >> greg >> > One way to avoid the "funny farm" is to learn to use the tools that > Python provides, built-in.

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Gregory Lund
> > Capital F. ZipFile not Zipfile. > Keyboard - Forehead - SCHMACK. (and hand/forehead smack.) DOH! Thank you. Greg ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 22:15, Gregory Lund wrote: > >> but now get a " x = zipfile.Zipfile(item,'r') > >> AttributeError: 'module' object has no attribute 'Zipfile' " > >> > >> error > >> > >> gr, this is going to send me to the funny farm! > >> > >> greg > >> > > One way to avoid the "funny

Re: [Tutor] running program in terminal

2012-09-24 Thread Matt Hite
On Mon, Sep 24, 2012 at 9:41 AM, Benjamin Fishbein wrote: > Hello. I can run programs in IDLE but when I try to do it in a terminal or > with textwrangler, it usually just logs out and says it's completed, but the > program hasn't been run. This is particularly so when the program uses > urllib

[Tutor] OT: Netiquette

2012-09-24 Thread Prasad, Ramit
Note: attributions might be a bit off due to the way this was sent. Dwight Hutto wrote: > > Dwight, > > Please stop responding to Mark. His behaviour is typical schoolyard > bully, meaning he's saying things precisely because he gets a reaction > from you. He probably doesn't even realise th

Re: [Tutor] running program in terminal

2012-09-24 Thread Alan Gauld
On 24/09/12 17:41, Benjamin Fishbein wrote: Hello. I can run programs in IDLE but when I try to do it in a terminal or with textwrangler, it usually just logs out and says it's completed, but the program hasn't been run. This is particularly so when the program uses urllib. I'm using OS X. lo

Re: [Tutor] BMI Question

2012-09-24 Thread Alan Gauld
On 24/09/12 20:13, Aija Thompson wrote: Hi! So I've been working on this question for hours! And Python keeps giving me an error saying that my syntax for BMI is wrong. I really can't understand why. So send us the full error text not a summary. If Python reports a syntax its usually recorde

Re: [Tutor] BMI Question

2012-09-24 Thread Dwight Hutto
On Mon, Sep 24, 2012 at 7:13 PM, Alan Gauld wrote: > On 24/09/12 20:13, Aija Thompson wrote: >> >> Hi! >> >> So I've been working on this question for hours! And Python keeps giving >> me an error saying that my syntax for BMI is wrong. I really can't >> understand why. > > I'd suggest an editor,

Re: [Tutor] BMI Question

2012-09-24 Thread Dwight Hutto
On Mon, Sep 24, 2012 at 7:25 PM, Dwight Hutto wrote: > On Mon, Sep 24, 2012 at 7:13 PM, Alan Gauld wrote: >> On 24/09/12 20:13, Aija Thompson wrote: >>> >>> Hi! >>> >>> So I've been working on this question for hours! And Python keeps giving >>> me an error saying that my syntax for BMI is wrong.

Re: [Tutor] running program in terminal

2012-09-24 Thread Benjamin Fishbein
> > Can you start up a terminal window then try to run your program and finally > paste the whole session into a mail and post it here? > > That should help. > If your program is complex try a simple one like: > > print ('Hello world') > input('Hit enter to quit...') Last login: Mon Sep 24 18:

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Gregory Lund
> No but Python did when it ran your code and it tried to tell you. The trick > is to read the error message, see what line of code it occurs at and then > look very closely at that line of code and the surrounding lines of code. > The first thing to check for is a typo. To be honest, I did check

Re: [Tutor] running program in terminal

2012-09-24 Thread Alan Gauld
On 25/09/12 00:31, Benjamin Fishbein wrote: Last login: Mon Sep 24 18:27:48 on ttys000 Benjamins-MacBook-Air:~ bfishbein$ cd '/Users/bfishbein/Documents/Python in Use/' && '/usr/local/bin/pythonw' '/Users/bfishbein/Documents/Python in Use/BB.py' && echo Exit status: $? && e

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Oscar Benjamin
On 25 September 2012 00:33, Gregory Lund wrote: > > z.extractall(outDir) > > zipContents = z.namelist() > print zipContents > z.close() > > for item in zipContents: > if item.endswith('.zip'): > x = zipfile.ZipFile(item,'r') > x.extractall() > x.close() > > Traceback (m

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Gregory Lund
>> Near as I can tell, I got rid of the permissions error, the ZipFile >> error with the missing capital 'F' >> Now I need to 'get into' the non zipped folder of each student and >> unzip any and all zips that are inside of it. > > > The error message says 'No such file or directory'. That means th