[Tutor] audio splitting with python

2008-10-02 Thread Daniele
Hi list, I'd like to split an ogg audio file into pieces (small enough to fit in an audio cd). Can anybody suggest me a python module to do that? Thanks, Daniele ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] audio splitting with python

2008-10-02 Thread Kent Johnson
On Thu, Oct 2, 2008 at 3:52 AM, Daniele <[EMAIL PROTECTED]> wrote: > Hi list, > I'd like to split an ogg audio file into pieces (small enough to fit > in an audio cd). Can anybody suggest me a python module to do that? Perhaps PyOgg or oggpy: http://ekyo.nerim.net/software/pyogg/ http://dingoskidn

Re: [Tutor] Hands-on beginner's project?

2008-10-02 Thread nathan virgil
Okay, I'm resurrecting this project. I did a little more work on it then what you see here, but that ended up getting accidentally deleted, and I haven't done anything with Python since. I'm running into one problem already, and I haven't really added any extra code. In the content (at this point,

Re: [Tutor] Hands-on beginner's project?

2008-10-02 Thread Luke Paireepinart
room == start is a comparison (check if room is equal to start - doesn't make a whole lot of sense to be doing that here). The "room" variable name doesn't exist in the current namespace, so it can't be compared to start. It looks like you wanted room = start. On 10/2/08, nathan virgil <[EMAIL PR

[Tutor] syntax error with a simple print command

2008-10-02 Thread David
Dear list, I was just trying the following code: for i in range(0, 10, 2): print i print "done!" But I do get a syntax error, and I don't understand why: >>> for i in range(0, 10, 2): ... print i ... print "done!" File "", line 3 print "done!" ^ As far as I understand, t

Re: [Tutor] syntax error with a simple print command

2008-10-02 Thread Luke Paireepinart
You are having an issue with the interpreter. You can only submit 1 command at a time to the interpreter. Therefore, you need to finish your for loop and hit enter *twice* so that the interpreter knows you're done with the loop. The reason you're getting an error is it's trying to put your "print

Re: [Tutor] syntax error with a simple print command

2008-10-02 Thread Luke Paireepinart
note that I meant it's not tabbed correctly *to be part of the for loop*. On Thu, Oct 2, 2008 at 9:42 AM, Luke Paireepinart <[EMAIL PROTECTED]>wrote: > You are having an issue with the interpreter. You can only submit 1 > command at a time to the interpreter. > Therefore, you need to finish your

Re: [Tutor] sample python twill scripts?

2008-10-02 Thread bob gailer
jeremiah wrote: Just wondering if anyone here would be interested in sharing a python twill script? I'd just like to take a gander at how others are engineering their scripts. twill? -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
I am using python 2.5.2.  Is there an alternative to idle that does not have this problem? (I also fixed that this was no longer a problem). ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
No that does not work.  When I click on idle it just does not open - very annoying. --- On Thu, 2/10/08, Luke Paireepinart <[EMAIL PROTECTED]> wrote: From: Luke Paireepinart <[EMAIL PROTECTED]> Subject: Re: [Tutor] Idle and windows XP firewall To: [EMAIL PROTECTED] Cc: tutor@python.org Date: Thur

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread Luke Paireepinart
On Thu, Oct 2, 2008 at 10:31 AM, David Holland <[EMAIL PROTECTED]>wrote: > I am using python 2.5.2. Is there an alternative to idle that does not > have this problem? > (I also fixed that this was no longer a problem). > > Open IDLE without using the "edit with IDLE" link. Or use a different edit

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread Luke Paireepinart
Where are you running it from? it needs some weird command line parameters, so you probably need to use the shortcut in the start bar that Python made for you. On Thu, Oct 2, 2008 at 10:55 AM, David Holland <[EMAIL PROTECTED]>wrote: > No that does not work. When I click on idle it just does not

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
I just using the short cut and nothing happens :(. I have managed to do this before just not in my new job --- On Thu, 2/10/08, Luke Paireepinart <[EMAIL PROTECTED]> wrote: From: Luke Paireepinart <[EMAIL PROTECTED]> Subject: Re: [Tutor] Idle and windows XP firewall To: [EMAIL PROTECTED] Cc: tuto

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread Luke Paireepinart
Try installing pythonwin, it's an editor by the guy that made the win32all extensions. Or use eclipse with Python plugin, maybe? On Thu, Oct 2, 2008 at 11:31 AM, David Holland <[EMAIL PROTECTED]>wrote: > I just using the short cut and nothing happens :(. > > I have managed to do this before just

Re: [Tutor] syntax error with a simple print command

2008-10-02 Thread Luke Paireepinart
On Thu, Oct 2, 2008 at 11:42 AM, David <[EMAIL PROTECTED]> wrote: > Thanks, Luke, that makes sense. > This is only applicable to the interpreter, though. It's perfectly legal to have a statement on the line immediately following a loop when you're writing code files. Also, please use "reply all"

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
That works thanks --- On Thu, 2/10/08, Luke Paireepinart <[EMAIL PROTECTED]> wrote: From: Luke Paireepinart <[EMAIL PROTECTED]> Subject: Re: [Tutor] Idle and windows XP firewall To: [EMAIL PROTECTED] Cc: tutor@python.org Date: Thursday, 2 October, 2008, 5:33 PM Try installing pythonwin, it's an e

[Tutor] dealing with user input whose value I don't know

2008-10-02 Thread David
Hello, I am trying to do some exercises in John Zelle's book (chapter 4). I got stuck: "Write a program that finds the average of a series of numbers entered by the user. The program should first ask the user how many numbers there are. Note: the average should always be a float, even if the u

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread Luke Paireepinart
On Thu, Oct 2, 2008 at 12:00 PM, David Holland <[EMAIL PROTECTED]> wrote: > > That works thanks > You should send e-mails to the list in plaintext, because it's really hard to reply to your e-mails in HTML mode. I mean, it's not hard for me to convert them, but it's just one of those minor nuisance

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Luke Paireepinart
On Thu, Oct 2, 2008 at 12:06 PM, David <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to do some exercises in John Zelle's book (chapter 4). > I got stuck: > > "Write a program that finds the average of a series of numbers entered by > the user. The program should first ask the user how many n

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
On Fri, Oct 03, 2008 at 01:06:29AM +0800, David wrote: > Hello, > > I am trying to do some exercises in John Zelle's book (chapter 4). > I got stuck: > > Okay, I can ask how many number are to be added: > > numbers = input("How many number do you want me to calculate? ") > > If I then get a rep

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread christopher . henk
[EMAIL PROTECTED] wrote on 10/02/2008 01:06:29 PM: > Hello, > > I am trying to do some exercises in John Zelle's book (chapter 4). > I got stuck: > > "Write a program that finds the average of a series of numbers entered > by the user. The program should first ask the user how many numbers >

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread David
Hello Christopher, [EMAIL PROTECTED] wrote: > > Okay, I can ask how many number are to be added: > > numbers = input("How many number do you want me to calculate? ") you should really use raw_input to get the info from the user, and then convert it to a number. numbers=int

[Tutor] Multiple windows in Tkinter

2008-10-02 Thread Glen Clark
Hello, I am a little confused how multi-windows work in Tkinter. I am currently using it while learning to program. Using it for single window apps/scripts is fine. However what I dont understand is: What is toplevel? Is it the same as Tk()? Do I initialise a root using Tk() and then use toplevel

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
On Fri, Oct 03, 2008 at 01:38:48AM +0800, David wrote: > Does that mean input() is obsolete (after all, Zelle's book is not the > freshest on the shelf)? Or do they have different uses? Depends on how you look at it. input() automatically evaluates whatever the user types as a Python expression

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Bill Campbell
On Thu, Oct 02, 2008, Steve Willoughby wrote: >On Fri, Oct 03, 2008 at 01:38:48AM +0800, David wrote: >> Does that mean input() is obsolete (after all, Zelle's book is not the >> freshest on the shelf)? Or do they have different uses? > >Depends on how you look at it. > >input() automatically eval

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread David
Cheers for the insights! However, I just found out that changing input() to raw_input() breaks my code: This program takes the average of numbers you supply!! How many numbers do you want me to work with? 2 You want me to take the average of 2 numbers. Please type the numbers, separated by com

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
On Thu, Oct 02, 2008 at 10:54:56AM -0700, Bill Campbell wrote: > Remember the cardinal rule NEVER TRUST USER INPUT! Always check > for validity, and use methods that prevent malicious strings from > allowing the user to get unauthorized access or change things > they shouldn't. Yes, I probably sh

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
On Fri, Oct 03, 2008 at 02:06:47AM +0800, David wrote: > Cheers for the insights! > > However, I just found out that changing input() to raw_input() breaks my > code: Recall that we told you raw_input() returns a string, while input() returns an integer if you typed an integer value. So you nee

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread christopher . henk
I am not sure how you got from the input to your variable i, it is a good idea to post your code as well. That said raw_input will return the user's input as a string which you then need to convert to integers. So the commas are brought in as well. You can solve this in a couple of ways: First,

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread David
Hello Steve, thanks for all your help and comments. What happens, though, is that with numbers = int(raw_input("Please type the numbers, separated by commas: ")) my code is still defunct (whereas input() works): Please type the numbers, separated by commas: 1,2 Traceback (most recent call las

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread David
Oh, great, this answers my question! Thanks! David [EMAIL PROTECTED] wrote: I am not sure how you got from the input to your variable i, it is a good idea to post your code as well. That said raw_input will return the user's input as a string which you then need to convert to integers.

[Tutor] Hello again. and another question.

2008-10-02 Thread tsmundahl
Hello Trask, I have been working on the first program. I got the files to read and print out the grades and averages, but when I write these files to the other txt file, all that I get is: 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 I know it is something simple. I am just not seeing it

Re: [Tutor] Hello again. and another question.

2008-10-02 Thread Steve Willoughby
On Thu, Oct 02, 2008 at 09:41:37PM +, [EMAIL PROTECTED] wrote: > for count in range (len(Grades)): > grades_file_2.write(str("%.2f"% (len(Grades))) + "\n") Look at what you're actually writing for each count. See anything amiss the

Re: [Tutor] sample python twill scripts?

2008-10-02 Thread Jeff Younker
On Oct 2, 2008, at 8:21 AM, bob gailer wrote: jeremiah wrote: Just wondering if anyone here would be interested in sharing a python twill script? I'd just like to take a gander at how others are engineering their scripts. twill? Twill is an http client automation tool. It's used quite a

Re: [Tutor] Hello again. and another question.

2008-10-02 Thread Steve Willoughby
You're doing a good job getting started with programming here, keep getting the fundamentals and then learn to refine those concepts over time. But for future reference, here are some finer points for you to keep in mind to improve your style and get a more Pythonic approach: On Thu, Oct 02, 200

Re: [Tutor] Multiple windows in Tkinter

2008-10-02 Thread John Fouhy
2008/10/3 Glen Clark <[EMAIL PROTECTED]>: > What is toplevel? Is it the same as Tk()? Do I initialise a root using Tk() > and then use toplevel for any other windows? How do I switch between the > Windows? And while I am on the subject what is a frame and why should I use > it? atm the moment it ju

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Alan Gauld
"David" <[EMAIL PROTECTED]> wrote However, I just found out that changing input() to raw_input() breaks my code: You want to know the average of the numbers: 1,2 Traceback (most recent call last): File "avgInput.py", line 13, in add = add + i TypeError: unsupported operand type(s) for +:

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Alan Gauld
"David" <[EMAIL PROTECTED]> wrote Does that mean input() is obsolete (after all, Zelle's book is not the freshest on the shelf)? Or do they have different uses? They have different uses and input is very convenient at the >>> prompt or when experimenting but in most cases is the wrong choic

Re: [Tutor] Multiple windows in Tkinter

2008-10-02 Thread Alan Gauld
"Glen Clark" <[EMAIL PROTECTED]> wrote I am a little confused how multi-windows work in Tkinter. I am currently using it while learning to program. Using it for single window apps/scripts is fine. However what I dont understand is: What is toplevel? Is it the same as Tk()? In any GUI thee i

Re: [Tutor] Hello again. and another question.

2008-10-02 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote I got the files to read and print out the grades and averages, but when I write these files to the other txt file, all that I get is: 10.0 10.0... I know it is something simple. I am just not seeing it. When the output doesn't vary like this you know you must be wr

[Tutor] How trustworthy are pseudo-random numbers?

2008-10-02 Thread Alec Henriksen
Hello list, How trustworthy is the "randomness" generated by the random module? I just wrote a script (with the help of some tutors here!) that finds the largest streak in a series of coin flips. My collected data: 100 coin flips = 6-7 streak (usually) 1000 coin flips = 10-12 streak (usually) 10

Re: [Tutor] How trustworthy are pseudo-random numbers?

2008-10-02 Thread Tim Peters
[Alec Henriksen] > How trustworthy is the "randomness" generated by the random module? Python uses the Mersenne Twister algorithm for generating pseudo-random numbers, and that's one of the highest-quality methods known. You can read more about it, e.g., here: http://en.wikipedia.org/wiki/Me