[mod_python] Error in reading remote server file with HTTP

Peter Bittner peter.bittner at gmx.net
Thu Aug 5 13:13:54 EDT 2010


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: mod_python-bounces at modpython.org
> [mailto:mod_python-bounces at modpython.org] On Behalf Of Rahul Warhekar
> Sent: Wednesday, August 02, 2010 9:16 PM
> To: mod_python at modpython.org
> 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 ‘True’ but when I
>
>
>
> Tries the same os.access(path, F_OK) function from browser it is returning
> ‘False’.
>
>
>
> 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.
>
>
>
>  Thanks In advance
>
> Rahul Warhekar



More information about the Mod_python mailing list