[Tutor] list index out of range error

Remco Gerlich scarblac@pino.selwerd.nl
Wed, 21 Mar 2001 17:47:44 +0100


On Wed, Mar 21, 2001 at 11:44:27AM -0500, D-Man wrote:
> On Tue, Mar 20, 2001 at 05:36:54PM -0700, VanL wrote:
> | On Unix, you are right.  On Windows,  that doesn't work.  At least,
> | I can't make it work.
> | 
> | -V-
> 
> You are right, Windows is horrible.  Example :  (the path does exist,
> and works when building the project using ant (a make replacement for
> java))
> 
> Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> >>> import os
> >>> os.system( "C:/Program Files/Microsoft Visual Studio/VSS/win32" )
> 'C:/Program' is not recognized as an internal or external command,
> operable program or batch file.
> 1
> >>> os.system( "C:/Program\ Files/Microsoft\ Visual\ Studio/VSS/win32"
> >>> )
> 'C:/Program\' is not recognized as an internal or external command,
> operable program or batch file.
> 1
> >>> os.system( "C:/Program\\ Files/Microsoft\\ Visual\\
> >>> Studio/VSS/win32" )
> 'C:/Program\' is not recognized as an internal or external command,
> operable program or batch file.
> 1
> >>>
> 
> 
> I think it is the windows shell that get's forked when os.system is
> called that is choking on the windows path.

IIRC, putting it between "double quotes" works in a DOS box, so with
os.system as well? What does

os.system('C:/"Program Files"/"Microsoft Visual Studio"/VSS/win32')

do? (it's still a pain to put each part between their own double quotes).

Ah, the evil of having spaces in filenames. Fortunately "Program Files"
and "My Documents" are never used...

-- 
Remco Gerlich