[python-win32] [SPAM-Keyword] - Re: Bug with system()/popen() ? - Found word(s) XXX in the Text body

Ludvig Strigeus lstrigeus at accuratetechnologies.com
Fri May 13 19:28:11 CEST 2005


Hi Tim.

When I did my tests I used r"", but I forgot it when i wrote the email
below.

Even if I use r"" it doesn't work.

The wrong stuff is put into Argv[2]
/path:C:\Temp /notempfile /closeonend 

Instead of
/path:"C:\Temp"

/Ludvig
-----Original Message-----
From: Tim Roberts [mailto:timr at probo.com] 
Sent: den 13 maj 2005 19:19
To: python-win32 at python.org
Subject: [SPAM-Keyword] - Re: [python-win32] Bug with system()/popen() ?
- Found word(s) XXX in the Text body


On Fri, 13 May 2005 05:08:13 -0400, "Ludvig Strigeus" 
<lstrigeus at accuratetechnologies.com> wrote:

>I'm trying to use system to run the following command:
>
>cmd  = C:\Program Files\Tortoise SVN\bin\TortoiseProc.exe Argv[1] = 
>/command:update Argv[2] = /path:"C:\Temp\Test"
>Argv[3] = /notempfile
>Argv[4] = /closeonend
>
>But all my attempts to convert this to a linearalized command line 
>fails...
>
>This is my most successful try (don't ask me why i have "" at the 
>start, it doesn't work at all otherwise): os.system('""C:\Program 
>Files\Tortoise SVN\bin\TortoiseProc.exe" /command:update 
>/path:"C:\Temp\Test" /notempfile /closeonend')
>  
>

You know that you need to escape all of those backslashes, right?  You 
either need to use an r"xxx" string or double the backslashes.  \b (as 
in ...\bin) is the character with ASCII code 7.

>But this puts /path:C:\Temp /notempfile /closeonend into Argv[2].
>
>Doing just:
>os.system('"C:\Program Files\Tortoise SVN\bin\TortoiseProc.exe" 
>/command:update /path:"C:\Temp\Test" /notempfile /closeonend')
>
>Prints that C:\Program is not a valid command or program.
>
>Any ideas? Is there some python function that doesn't require me to 
>linearalize the command line, or is there some workaround so the above 
>example works? (I need the functionality of popen())
>  
>

This is one reason why I always override the installation directory to 
one without spaces.

One alternative is to fall back to:
    os.system('c:\\progra~1\\tortoi~1\\bin\\TortoiseProc.exe 
/command:update /path:c:\\temp\\test /notempfile /closeonend')

Or:

  os.environ['PATH'] = os.environ['PATH'] + ';c:\\Program 
Files\\Tortoise SVN\\bin'
  os.system('TortoiseProc.exe /command: ...')

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32


More information about the Python-win32 mailing list