[Tutor] list index out of range error

Shawhan, Douglas (GEAE, GECC) douglas.shawhan@ae.ge.com
Tue, 20 Mar 2001 18:03:27 -0500


When I attempt to run the following:

--------------begin yamo.py------------------------
import glob
import string
gunther=open('/windows/desktop/merciful_wombat.html', 'w')
yamo=glob.glob("/windows/desktop/*.html")
a=0;b=100
while a < b:
	gunther.write('<html><body
bgcolor=white><table><tr><td>'+`yamo[a]`+'<tr><td
bgcolor=#aaaaaa>&nbsp;&nbsp;</table>'),
	a=a+1
gunther.close()
os.system('iexplore.exe /windows/desktop/merciful_wombat.html')
 
--------------end yamo.py---------------------------

I get the following error:

--------------erratta mondatta----------------------

C:\WINDOWS\DESKTOP>python yamo.py
Traceback (most recent call last):
  File "yamo.py", line 7, in ?
    gunther.write('<html><body
bgcolor=white><table><tr><td>'+`yamo[a]`+'<tr><td
 bgcolor=#aaaaaa>&nbsp;&nbsp;</table>'),
IndexError: list index out of range

--------------end erratta mondatta----------------

It writes the file "merciful_wombat.html" file just fine. But it gives me
the error message all the same.

Too many iterations in my while?

And another thing: 

import os
os.system('notepad.exe')

works fine, while

import os
os.system ('iexplore.exe')

does not. Is there  a path problem here?