Spaces in path name

Bryan Olson fakeaddress at nowhere.org
Fri Mar 14 04:18:51 EDT 2008


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' % ANT_CMD)

There you don't want the quotes within the string. On my MS-Win box:

   >>> import os
   >>> os.path.isfile(r'C:\Program Files\Windows NT\dialer.exe')
   True
   >>> print os.path.isfile(r'"C:\Program Files\Windows NT\dialer.exe"')
   False


-- 
--Bryan



More information about the Python-list mailing list