By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

Re: os.path.exists() function does not work for http paths

P: n/a
du**********@gmail.com wrote:
Hi,

I have used os.path.exists() many a times for any file system paths in
local system. But this does not seem to work for an Http path.

e.g:
To check is the Results folder exists at the following path, I do:
if not os.path.exists("http://subversion.myCom.com/Testing/Results"):
print 'Path does not exist'
This always prints the above print statements whether or not the Results
folder exists or not.

Is there any such function to check existence of files. / folder at Http
paths?
You could use one of the URL libraries. The os.path module is for
dealing with the local filesystem.

The absence of any exception from

f = urllib.urlopen("http://www.google.com/webhp/")

is a good indication that the addressed page "exists" (but remember that
the web is a virtual address space, so it doesn't necessarily mean that
there's a real file or directory object behind ot).

regards
Steve

--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 29 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.