Spaces in path name

David S davids at
Fri Mar 14 05:37:12 CET 2008


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)


"Mensanator" <mensanator at> wrote in message 
news:360a8612-f5a2-4f2f-bae2-c89ed35b7d1b at
On Mar 13, 5:16 pm, "David S" <dav... at> 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 script 
> the
> path will be found.
> ANT_CMD = r'C:\Program Files\apache-ant-1.7.0\bin\ant'

Try ANT_CMD  = r'"C:\Program Files\apache-ant-1.7.0\bin\ant"'

> Regards,
> David

More information about the Python-list mailing list