Re: Spaces in path name

2008-03-17 Thread Gertjan Klein
joep wrote: * If shell=True is required, then the executable is a build-in shell command, which does not contain spaces, and, therefore, has no problems This is only true when you are referring to directly executable files. However, Shell=True is also required when you want to execute a file by

Re: Spaces in path name

2008-03-17 Thread Tim Golden
Gertjan Klein wrote: joep wrote: * If shell=True is required, then the executable is a build-in shell command, which does not contain spaces, and, therefore, has no problems This is only true when you are referring to directly executable files. However, Shell=True is also required when

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: On Mar 15, 5:42 pm, joep [EMAIL PROTECTED] wrote: http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with spaces. Especially, even

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: joep wrote: On Mar 15, 5:42 pm, joep [EMAIL PROTECTED] wrote: http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with

Re: Spaces in path name

2008-03-16 Thread joep
Tim Golden wrote: subprocess.call ([ rC:\Program Files\Adobe\Acrobat 5.0\Reader\acro reader.exe, rC:\Program Files\Adobe\Acr obat 5.0\Reader\plug_ins.donotuse\Annotations\Stamps\abc def.pdf ]) Can you confirm that something equivalent *doesn't* work on your setup? Or have I

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: Tim Golden wrote: subprocess.call ([ rC:\Program Files\Adobe\Acrobat 5.0\Reader\acro reader.exe, rC:\Program Files\Adobe\Acr obat 5.0\Reader\plug_ins.donotuse\Annotations\Stamps\abc def.pdf ]) Can you confirm that something equivalent *doesn't* work on your setup? Or

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: I assume that there is some difference how subprocess.call and subprocess.Popen handle and format the command. subprocess.Popen does the correct formatting when only one file path has spaces and requires double quoting, but not if there are two file paths with spaces in it. The

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: What I haven't investigated yet is whether the additional flags your example is passing (shell=True etc.) cause the main Popen mechanism to take a different path. Sure enough, passing shell=True -- which is probably quite a rare requirement -- causes the code to change the

Re: Spaces in path name

2008-03-16 Thread joep
Tim Golden wrote: Tim Golden wrote: What I haven't investigated yet is whether the additional flags your example is passing (shell=True etc.) cause the main Popen mechanism to take a different path. Sure enough, passing shell=True -- which is probably quite a rare requirement -- causes

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: Tim Golden wrote: Tim Golden wrote: What I haven't investigated yet is whether the additional flags your example is passing (shell=True etc.) cause the main Popen mechanism to take a different path. Sure enough, passing shell=True -- which is probably quite a rare requirement

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: Well I've got a patch ready to go (which basically just wraps a shell=True command line with an *extra* pair of double-quotes, the same as you do for an os.system call). I'll try to put some time into the subprocess docs as well, at least as far as a Win32-how-do-I on my own

Re: Spaces in path name

2008-03-16 Thread joep
One more try (using popen instead of call is not necessary for these cases, but I want to see the behavior of popen): shell=True and executable and at least one argument with spaces does not work:

Re: Spaces in path name

2008-03-15 Thread Tim Golden
joep wrote: I had the same problem recently with subprocess.popen, when there is a space in the executable and a space in an additional argument as in the acrobat example. I finally found a past thread in this news group that explained that you have to use two (2) leading double quotes, and

Re: Spaces in path name

2008-03-15 Thread joep
http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with spaces. Especially, even after trying out many different versions, I never managed to get

Re: Spaces in path name

2008-03-15 Thread joep
On Mar 15, 5:42 pm, joep [EMAIL PROTECTED] wrote: http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with spaces. Especially, even after trying

Re: Spaces in path name

2008-03-14 Thread David S
Hi, Using C:\Program Files\apache-ant-1.7.0\bin\ant.bat just gives me the same result. David Dennis Lee Bieber [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 14 Mar 2008 04:37:12 GMT, David S [EMAIL PROTECTED] declaimed the following in comp.lang.python: If I cut the

Re: Spaces in path name

2008-03-14 Thread Bryan Olson
David S wrote: I get ERROR: C:\Program Files\apache-ant-1.7.0\bin\ant does not exist If I cut the path statement here and paste it next to a windows XP command prompt ant is invoked. The python code here is if not os.path.isfile(ANT_CMD): error('%s does not exist' %

Re: Spaces in path name

2008-03-14 Thread Bryan Olson
David S wrote: Using C:\Program Files\apache-ant-1.7.0\bin\ant.bat just gives me the same result. Did you try the raw string, with the .bat extension? As in: r'C:\Program Files\apache-ant-1.7.0\bin\ant.bat' After Microsoft started allowing blanks in paths, it took them years to fix many

Re: Spaces in path name

2008-03-14 Thread David S
Hi, Gets me further but still seems to be issue with space after 'Program' as code tries to run 'C:\Program'. Don't understand what is going on here... using java.exe from C:\Program Files\Java\jdk1.6.0_01 using C:\Program Files\apache-ant-1.7.0\bin\ant.bat for building Building from

Re: Spaces in path name

2008-03-14 Thread Tim Golden
David S wrote: Gets me further but still seems to be issue with space after 'Program' as code tries to run 'C:\Program'. Don't understand what is going on here... Slight apologies as I haven't followed this thread closely, but using the Acrobat Reader executable, which is, I think, good

Re: Spaces in path name

2008-03-14 Thread David S
By mapping network drives in windows I can get past these issues with path names. Thanks, David Tim Golden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] David S wrote: Gets me further but still seems to be issue with space after 'Program' as code tries to run 'C:\Program'.

Re: Spaces in path name

2008-03-14 Thread joep
On Mar 14, 8:15 pm, David S [EMAIL PROTECTED] wrote: By mapping network drives in windows I can get past these issues with path names. Thanks, David Tim Golden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] David S wrote: Gets me further but still seems to be issue with

Spaces in path name

2008-03-13 Thread David S
Hi, I have some code in which I have to change some path names to get it to work. The original code seems to have assumed that path names would not have any embedded spaces. I am not sure how to write the following line so when used in my script the path will be found. ANT_CMD =

Re: Spaces in path name

2008-03-13 Thread Mensanator
On Mar 13, 5:16 pm, David S [EMAIL PROTECTED] wrote: Hi, I have some code in which I have to change some path names to get it to work. The original code seems to have assumed that path names would not have any embedded spaces. I am not sure how to write the following line so when used in my

Re: Spaces in path name

2008-03-13 Thread David S
Hi, I get ERROR: C:\Program Files\apache-ant-1.7.0\bin\ant does not exist If I cut the path statement here and paste it next to a windows XP command prompt ant is invoked. The python code here is if not os.path.isfile(ANT_CMD): error('%s does not exist' % ANT_CMD) David