Grupos de Google ya no admite publicaciones ni suscripciones nuevas de Usenet. El contenido anterior sigue visible.

os.system() bug?

2,248 vistas
Ir al primer mensaje no leído

Johan Fredrik Øhman

no leída,
8 jun 2003, 6:22:44 p.m.8/6/2003
para
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on win32

>>> os.system('"C:\Program Files\UltraEdit\uedit32.exe" "arg"')
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
1
>>> os.system('""C:\Program Files\UltraEdit\uedit32.exe" "arg"')
0

I am really stumbeled by this! Why do I have to write two " at the
beginning of the command to make it work? Seems like this problem only
occurs when there is a space in the path.

--
Johan Fr Ohman


Tim Peters

no leída,
8 jun 2003, 6:58:58 p.m.8/6/2003
para
[Johan Fredrik Øhman]

>>>> os.system('"C:\Program Files\UltraEdit\uedit32.exe" "arg"')
> 'C:\Program' is not recognized as an internal or external command,
> operable program or batch file.
> 1
>>>> os.system('""C:\Program Files\UltraEdit\uedit32.exe" "arg"') 0
>
> I am really stumbeled by this! Why do I have to write two " at the
> beginning of the command to make it work? Seems like this problem
> only occurs when there is a space in the path.

That's right. os.system() opens a command shell, and this behavior is
inherited from your command shell. If you open a "DOS box" and type the
same things at it, you'll get the same results -- it's the Windows command
shells that require quoting paths with embedded spaces.

0 mensajes nuevos