Re: Error in reading remote server file with HTTP

Peter Bittner <[email protected]> Thu, 5 Aug 2010 19:13:54 +0200
Newsgroups gmane.comp.python.mod_python
Message-ID <[email protected]>
Rahul,

> I want to open remote servers text file using mod_python in my program,=
 to
> display file contents in browser for reading.

If I understand correcty you want to figure out with a mod_python
program whether a text file on another webserver (which is out of your
control) exists. Correct?

> Os.access(path, os.F_OK) function.

To what I know you can't do that with the os module. You can only
check local paths an a filesystem this way. You would have to perform
an HTTP request on the webserver and interpret the result. If you get
an Error404 the file does not exist.

Does the help you?
Peter


> From: [email protected]
> [mailto:[email protected]] On Behalf Of Rahul Warhekar
> Sent: Wednesday, August 02, 2010 9:16 PM
> To: [email protected]
> Subject: [mod_python] Error in reading remote server file with HTTP
>
>
>
> Hello All,
>
>
>
> I am trying to read file from remote machine using mod_python, but I am
> getting Error while using opening the file.
>
>
>
> So I tried to use os.access (path, F_OK) to check for path availability=
 from
> Python IDE so it returns =91True=92 but when I
>
>
>
> Tries the same os.access(path, F_OK) function from browser it is return=
ing
> =91False=92.
>
>
>
> I think this function might be due to some security reasons but my
> os.access() is returning true when executed from
>
>
>
> Python IDE.
>
>
>
> Any help regarding this will be greatly appreciated.
>
>
>
> =A0Thanks In advance
>
> Rahul Warhekar