Re: [Tutor] IndexError: list index out of range

2016-12-27 Thread Alan Gauld via Tutor
On 27/12/16 15:22, Mysore Ventaka Rama Kumar wrote: > Please review and comment/correct my error! Rather than expect us to read through many lines of code it would help id you posted the entire error message which will tell us exactly where the problem lies. Also tell us for completeness which

[Tutor] IndexError: list index out of range

2016-12-27 Thread Mysore Ventaka Rama Kumar
Please review and comment/correct my error! Many thanks in advance. # Required module import os # Function for getting files from a folder def fetchFiles(pathToFolder, flag, keyWord): ''' fetchFiles() requires three arguments: pathToFolder, flag and keyWord flag must be

[Tutor] IndexError: list index out of range

2014-06-26 Thread Myunggyo Lee
Hi all I just started to learn python language. I'm trying to figure out the reason of error but i couldn't find it. first imports short.txt(is attached to this mail) and read in dictionary named gpdic1 Traceback (most recent call last): File /home/ercsb/test.py, line 11, in module hgene =

Re: [Tutor] IndexError: list index out of range

2014-06-26 Thread Peter Otten
Myunggyo Lee wrote: I'm trying to figure out the reason of error but i couldn't find it. first imports short.txt(is attached to this mail) and read in dictionary named gpdic1 Traceback (most recent call last): File /home/ercsb/test.py, line 11, in module hgene = lines[1]

Re: [Tutor] IndexError: list index out of range

2014-06-26 Thread Dave Angel
Myunggyo Lee somrsa...@gmail.com Wrote in message: You apparently posted this in html, and you tried to attach a data file. Each of those will cause problems for some readers. Please tell your email program to use text mail, and paste in your data, don't attach it. gpdic1={} while 1:

Re: [Tutor] IndexError: list index out of range

2014-06-26 Thread Alan Gauld
On 26/06/14 09:18, Myunggyo Lee wrote: Hi all I just started to learn python language. Welcome. I'm trying to figure out the reason of error but i couldn't find it. first imports short.txt(is attached to this mail) and read in dictionary named gpdic1 Others have pointed out the specific

[Tutor] IndexError: list index out of range

2013-11-29 Thread richard kappler
I have a script that makes use of the Google speech recognition API as follows: import shlex print say something os.system('sox -r 16000 -t alsa default recording.flac silence 1 0.1 1% 1 1.5 1%') cmd='wget -q -U Mozilla/5.0 --post-file recording.flac --header=Content-Type: audio/x-flac;

Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 08:17:54PM -0500, richard kappler wrote: I have a script that makes use of the Google speech recognition API as follows: [...] args = shlex.split(cmd) output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() if not error:

Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread Danny Yoo
Here's another reason for avoiding eval(). Presumably a['hypotheses'] is set by the code you download and then eval. That makes it completely opaque -- you can't easily see what it is doing, and if it plays up, you can't do anything about it. It's a complete black box that either works or

Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread eryksun
On Fri, Nov 29, 2013 at 8:17 PM, richard kappler richkapp...@gmail.com wrote: args = shlex.split(cmd) output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() Output to stderr doesn't necessarily mean a command failed. The process returncode is

[Tutor] IndexError: list index out of range

2011-11-21 Thread John
Hi all, I have wriiten the following code: [Segment] def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) However when ever i run it i get this error message: Traceback (most recent call last): File pyshell#46, line

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread James Reynolds
On Tue, Nov 22, 2011 at 12:28 AM, John nidia...@hotmail.com wrote: Hi all, I have wriiten the following code: [Segment] def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) However when ever i run it i get this

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Alan Gauld
On 22/11/11 05:28, John wrote: def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) However when ever i run it i get this error message: next.remove (next[index]) IndexError: list index out of range Any ideas about whats causing this error?

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Dave Angel
On 11/22/2011 12:28 AM, John wrote: Hi all, I have wriiten the following code: I can't provide any more clues about your code than the two excellent replies you've already gotten. But it'd be really good if you could fix your time machine, so you're not posting in the future. Really hard

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Steven D'Aprano
John wrote: Hi all, I have wriiten the following code: [Segment] def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) What is the intention of this function? The name given doesn't mean anything to me. The parameters

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Nidian Job-Smith
, Deidre, Edward, Felicity, Greg, Harriet], 3) He answer should be ‘Greg’ Date: Tue, 22 Nov 2011 10:02:01 +1100 From: st...@pearwood.info To: tutor@python.org Subject: Re: [Tutor] IndexError: list index out of range John wrote: Hi all, I have wriiten the following code: [Segment

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread Asokan Pichai
On Tue, Nov 22, 2011 at 4:32 AM, Steven D'Aprano st...@pearwood.infowrote: John wrote: Hi all, I have wriiten the following code: [Segment] def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) What is the

Re: [Tutor] IndexError: list index out of range

2007-09-20 Thread Alan Gauld
bhaaluu [EMAIL PROTECTED] wrote of it. But the search worked even when stackB and stackC were empty. Interesting. You never checked stackB or stackC when they were empty because it always found something in a prior stack first. I could see, all three conditionals in popNum(num) were the

Re: [Tutor] IndexError: list index out of range

2007-09-20 Thread bhaaluu
On 9/20/07, Alan Gauld [EMAIL PROTECTED] wrote: bhaaluu [EMAIL PROTECTED] wrote of it. But the search worked even when stackB and stackC were empty. Interesting. You never checked stackB or stackC when they were empty because it always found something in a prior stack first. I could

[Tutor] IndexError: list index out of range

2007-09-19 Thread bhaaluu
Greetings, I'm working with Python 2.4.3 on the GNU/Linux platform. I'm currently playing with functions and stacks, and am using the Towers of Hanoi as a test game to play with. Note: This game is not a recursive programming exercise, it is meant to be solved by the player, manually. The

Re: [Tutor] IndexError: list index out of range

2007-09-19 Thread Michael Langford
You should check if the stack is empty before you access it: def popNum(num): if len(stackA) 0 and num == stackA[-1]: stackA.pop() #etc --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining:

Re: [Tutor] IndexError: list index out of range

2007-09-19 Thread Kent Johnson
bhaaluu wrote: def popNum(num): if num == stackA[-1]: stackA.pop() What happens here if stackA is empty? Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] IndexError: list index out of range

2007-09-19 Thread bhaaluu
On 9/19/07, Kent Johnson [EMAIL PROTECTED] wrote: bhaaluu wrote: def popNum(num): if num == stackA[-1]: stackA.pop() What happens here if stackA is empty? Kent This was how I was looking for the number. It seems to me that if the list was EMPTY or didn't have the sought

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-14 Thread John Joseph
--- Danny Yoo [EMAIL PROTECTED] wrote: I get the error for set set((1,1,1,2,2,2,2,2,3,4,4,5)) Traceback (most recent call last): File stdin, line 1, in ? NameError: name 'set' is not defined Hi John, For Python 2.3.4, you'll need to add the line: ## from

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-09 Thread John Joseph
Hi Brian It was a excellent tutorial, Thanks a lot for the advice I got my concepts of def of functions , sort functions , count , cleared for me I was able to do and understand all the function example , except “item_comparison” function I get the

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-09 Thread Brian van den Broek
John Joseph said unto the world upon 09/01/06 03:47 AM: Hi Brian It was a excellent tutorial, Thanks a lot for the advice I got my concepts of def of functions , sort functions , count , cleared for me I was able to do and understand all the function

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-09 Thread Kent Johnson
Brian van den Broek wrote: Your python is a version before set was a built-in type (2.4, I believe). So, the iteration_comparison *and* dupe_detector_5 functions won't work for you. 2.3 did include the sets module, though. So, stick from sets import set at the top of the code and

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-09 Thread Danny Yoo
lot for the advice I got my concepts of def of functions , sort functions , count , cleared for me I was able to do and understand all the function example , except �item_comparison� function I get the error for set set((1,1,1,2,2,2,2,2,3,4,4,5)) Traceback

[Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-08 Thread John Joseph
Hi All I am trying to find out the duplicates in a list , as for beginning I wanted to compare the adjacent elements in list , for this purpose I wrote a script for checking the adjacent elements in a list, if same , it prints the result that , the adjacent numbers are same , it not it

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-08 Thread Guillermo Fernandez Castellanos
Hi, Look at this: i=[1,2,3] i[len(i)] Traceback (most recent call last): File stdin, line 1, in ? IndexError: list index out of range This means that I have tried to access an element that is out of the list, in this case i[3], that is, the 4th element of the list. You are doing the

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-08 Thread John Joseph
--- Guillermo Fernandez Castellanos [EMAIL PROTECTED] wrote: Hi, Look at this: i=[1,2,3] i[len(i)] Traceback (most recent call last): File stdin, line 1, in ? IndexError: list index out of range This means that I have tried to access an element that is out of the list, in

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-08 Thread Brian van den Broek
John Joseph said unto the world upon 08/01/06 06:36 AM: --- Guillermo Fernandez Castellanos [EMAIL PROTECTED] wrote: Hi, Look at this: i=[1,2,3] i[len(i)] Traceback (most recent call last): File stdin, line 1, in ? IndexError: list index out of range This means that I have tried to