[Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
hello, i have a string that is generated that contains letters and numbers. i also have a folder which contains the following: sounds/ upper-a.wav upper-b.wav .. lower-a.wav lower-b.wav ... sign-£.wav sign-|.wav .. number-0.wav number-1.wav .. does anyone know of a python module which would

[Tutor] MySqldb problem

2009-01-20 Thread Manoj kumar
  hi all, i am a newbie to python programming. i just know basics of the language. i came across MySqldb. i able to manipulate database with MySqldb but i wasn't able to add files in database through the lib MySqldb. any help will be welcomed gracefully. thanks.

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Kent Johnson
On Mon, Jan 19, 2009 at 9:47 PM, Emad Nawfal (عماد نوفل) emadnaw...@gmail.com wrote: Thanks John for this. Although the decorate-sort-undecorate idiom looks so natural to me now, I don't think I would have found it on my own. I have that deja vu effect towards it. decorate-sort-undecorate is

Re: [Tutor] Question about pygame/tkinter interaction

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 15:46:27 -0800, Steve Willoughby wrote: On Mon, Jan 19, 2009 at 05:30:01PM -0500, Kent Johnson wrote: My guess is that pygame and Tkinter are both going to want to control the event loop. Googling 'pygame tkinter' gives both hints that it might be possible and hints of

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 4:49 AM, Norman Khine nor...@khine.net wrote: does anyone know of a python module which would create a single sound file based on the randomly generated string? i have looked at the python wave module, but if i am not wrong this works with one file at the time. I

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
2009/1/20 Kent Johnson ken...@tds.net On Mon, Jan 19, 2009 at 9:47 PM, Emad Nawfal (عماد نوفل) emadnaw...@gmail.com wrote: Thanks John for this. Although the decorate-sort-undecorate idiom looks so natural to me now, I don't think I would have found it on my own. I have that deja vu

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Thanks I am looking at this now. From unix I could run sox so that $ sox uppercase-a.wav uppercase-b.wav ab.wav this produces a merged uppercase-a.wav uppercase-b.wav perhaps this is a better way, but requires having to execute an external programme. any thoughts? cheers norman Kent

Re: [Tutor] MySqldb problem

2009-01-20 Thread Chris Babcock
On 20 Jan 2009 11:10:14 - Manoj kumar manoj_kumar2...@rediffmail.com wrote: i am a newbie to python programming. i just know basics of the language. i came across MySqldb. i able to manipulate database with MySqldb but i wasn't able to add files in database through the lib

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Is this a safe way to generate random sound files on a web server? from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') Thanks Norman Kent Johnson wrote: On Tue, Jan 20, 2009 at 4:49 AM, Norman Khine nor...@khine.net wrote: does anyone know of a python

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 7:13 AM, Emad Nawfal (عماد نوفل) emadnaw...@gmail.com wrote: 2009/1/20 Kent Johnson ken...@tds.net decorate-sort-undecorate is pretty much obsolete since the key= parameter was added to sort() in Python 2.4. When you say that something is obsolete, what does this mean?

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 8:12 AM, Norman Khine nor...@khine.net wrote: Is this a safe way to generate random sound files on a web server? from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') I'm not sure but you may have to read from merge to allow the process to

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 19:13:32 -0800, Marc Tompkins wrote: 2009/1/19 John Fouhy j...@fouhy.net 2009/1/20 Emad Nawfal (عماد نوفل) emadnaw...@gmail.com: Of course, this is not necessarily the best answer for your particular problem. The problem with sorting is that you have to look at some

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Thanks, Kent Johnson wrote: On Tue, Jan 20, 2009 at 8:12 AM, Norman Khine nor...@khine.net wrote: Is this a safe way to generate random sound files on a web server? from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') I'm not sure but you may have to read

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 9:00 AM, Norman Khine nor...@khine.net wrote: from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') I'm not sure but you may have to read from merge to allow the process to complete. You might want to use os.system() or one of the

Re: [Tutor] Ip address

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 19:47:54 -0800, wormwood_3 wrote: Hello, This is definitely possible. It's more a matter of system and OS configuration than Python though, so you might want to check out some Linux forums ( http://www.linuxforums.org/ ) for additional help. In short, I think the

[Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Paul McGuire
Finding the shortest word among a list of words sounds like something of a trick question to me. I think a more complete problem statement would be Find the list of words that are the shortest, since there is no guarantee that the list does not contain two words of the same shortest length. If

Re: [Tutor] Ip address

2009-01-20 Thread Irimia, Suleapa
wormwood_3 wrote: Hello, This is definitely possible. It's more a matter of system and OS configuration than Python though, so you might want to check out some Linux forums ( http://www.linuxforums.org/ ) for additional help. In short, I think the simplest would be: Have 3 separate network

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
On Tue, Jan 20, 2009 at 10:33 AM, Paul McGuire pt...@austin.rr.com wrote: Finding the shortest word among a list of words sounds like something of a trick question to me. I think a more complete problem statement would be Find the list of words that are the shortest, since there is no

Re: [Tutor] Question about pygame/tkinter interaction

2009-01-20 Thread Lie Ryan
On Tue, 2009-01-20 at 08:04 -0800, Steve Willoughby wrote: In this case, that might be enough. I just need to show a video clip in an otherwise fairly simple GUI. A decorationless, borderless window popped up on the screen over the Tk stuff would probably work. Thanks for the advice,

[Tutor] lists

2009-01-20 Thread Norman Khine
Hi What am I doing wrong media_list = ['upper_b.wav', 'upper_a.wav'] print '%s' % (for x in media_list) File stdin, line 1 print '%s' % (for x in media_list) ^ SyntaxError: invalid syntax print '%s' % (x for x in media_list) generator object at 0x532210 I want to

Re: [Tutor] lists

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 11:30 AM, Norman Khine nor...@khine.net wrote: Hi What am I doing wrong media_list = ['upper_b.wav', 'upper_a.wav'] print '%s' % (for x in media_list) File stdin, line 1 print '%s' % (for x in media_list) ^ SyntaxError: invalid syntax print

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 5:42 AM, Lie Ryan lie.1...@gmail.com wrote: Using sys.maxint to prime minLen is overkill, of course - antidisestablishmentarianism is only 28 letters long, after all - but it should be larger than any word you can expect to see. This doesn't catch ties, though...

Re: [Tutor] lists

2009-01-20 Thread Arun Tomar
hi! On Tue, Jan 20, 2009 at 10:30 PM, Kent Johnson ken...@tds.net wrote: On Tue, Jan 20, 2009 at 11:30 AM, Norman Khine nor...@khine.net wrote: Hi What am I doing wrong media_list = ['upper_b.wav', 'upper_a.wav'] print '%s' % (for x in media_list) File stdin, line 1 print '%s' % (for

Re: [Tutor] lists

2009-01-20 Thread Norman Khine
Hi, actually what I was trying to do carries from my last post, where my media files are a list that I want to add to the subprocess.call(['sox', ', '.join(media_list), 'list.wav']) print ', '.join(media_list) upper_b.wav, upper_a.wav subprocess.call(['sox', ', '.join(media_list),

[Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread Donna Belle Ibarra
Hi! I need help with program exericse #6 entitled Futval.py which is a program that computes the value of an investment carried 10 years into the future. This is the coding I have.. yet it does not seem to spit out the correct numbers (Am I using an incorrect equation?) *def main(): print

Re: [Tutor] lists

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 1:02 PM, Norman Khine nor...@khine.net wrote: Hi, actually what I was trying to do carries from my last post, where my media files are a list that I want to add to the subprocess.call(['sox', ', '.join(media_list), 'list.wav']) OK, you want a list, not a string. You

Re: [Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread bob gailer
Donna Belle Ibarra wrote: Hi! I need help with program exericse #6 entitled "Futval.py" which is a program that computes the value of an investment carried 10 years into the future. This is the coding I have.. yet it does not seem to spit out the correct numbers (Am I using an incorrect

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Lie Ryan
On Tue, 20 Jan 2009 09:20:22 -0800, Marc Tompkins wrote: On Tue, Jan 20, 2009 at 5:42 AM, Lie Ryan lie.1...@gmail.com wrote: Using sys.maxint to prime minLen is overkill, of course - antidisestablishmentarianism is only 28 letters long, after all - but it should be larger than any word

Re: [Tutor] lists

2009-01-20 Thread David
Norman Khine wrote: Hi, actually what I was trying to do carries from my last post, where my media files are a list that I want to add to the subprocess.call(['sox', ', '.join(media_list), 'list.wav']) Something like this may work; #!/usr/bin/python import subprocess def play(filename):

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 11:23 AM, Lie Ryan lie.1...@gmail.com wrote: what I meant as wrong is that it is possible that the code would be used for a string that doesn't represent human language, but arbitrary array of bytes. Also, it is a potential security issue. This is something I need to

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
On Tue, Jan 20, 2009 at 3:14 PM, Marc Tompkins marc.tompk...@gmail.comwrote: On Tue, Jan 20, 2009 at 11:23 AM, Lie Ryan lie.1...@gmail.com wrote: what I meant as wrong is that it is possible that the code would be used for a string that doesn't represent human language, but arbitrary array

Re: [Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread Mark Tolonen
Since you are updating the principal value each year, use the following to grow the principal by the interest rate each year: principal = principal * (1 + apr) -Mark bob gailer bgai...@gmail.com wrote in message news:49761fdc.5020...@gmail.com... Donna Belle Ibarra wrote: Hi! I need