Python and Intranet issues
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Aug 20 04:17:24 EDT 2002
rcw5459@*nospam*njit.edu wrote in news:ajrdf4$jf1$1 at news.netmar.com:
> The images were loaded fine...but I'm getting errors when tying to
> read the text file. At first I used open('\\blah\blahblah\info.txt',
> 'r') to try to get the info, but I was getting errors (no such file or
> directory). I've also tried several variations including:
> open('\\\\blah\\blahblah\\info.txt', 'r') and
> open('file:///\\\\blah\\blahblah\\info.txt', 'r').
>
Judging by this mess of backslashes, you forgot to mention that you are
running on a Microsoft Windows system using files shared across the
network. You really would be happier in this case with raw strings or
forward slashes:
open('//blah/blahblah/info.txt', 'r')
should work just fine.
> Can anyone tell me the correct syntax (or correct command, if I'm
> using the wrong ones) to use when trying to read a file off the
> network?
You don't say which web server your CGI program is hiding behind. May I
assume for the sake of argument that whatever it is, the web server is
running as a service? If this is the case, then the answer is probably just
that applications running in services are not generally granted access to
the network. (If you aren't running it as a service, then ignore my wild
ramblings.)
I would make the following suggestions:
Create a user name just to run your web service (a good idea in any case)
and give that user network access (a bad idea).
Investigate the NullSessionShares registry setting which allows the local
system account network access.
Get whatever generates the files to put them directly on the system where
you are running the CGI so you only need local file access.
Run a minimal web-server+cgi on the machine that actually contains the
files and use an apache reverse proxy to connect to it from the main web
server (if your main server is apache, if it is IIS then you can't do
this).
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list