[Tutor] Re: Document URI?

Lee Harr missive at hotmail.com
Wed Dec 10 18:07:05 EST 2003


>I had previously wrote a scrip that accessed a document's URI by getting
>os.environ['DOCUMENT_URI']
>
>Our server admin recently upgrade to Python2.3 and now Python is saying
>that there is no 'DOCUMENT_URI' key.
>
>I did some googling but I couldn't find a way to access a documents URI
>in python...
>
>FYI, the script is called via a SSI ala:
>File called /foo/index.html:
><!--#include virtual="/cgi-bin/script.py" -->
>
>Previously the os.environ['DOCUMENT_URI'] would return /foo/index.html
>but now its saying there's no value...


This is probably not a problem with the new python version, but with some
other change that occurred during the upgrade.

Where and how was that environment variable being set?

It could have been in the .login or .bashrc of the user owning the web
server process...

Or maybe you are using a web framework that sets that variable when it
receives a web request. Which web server / framework are you using?

Have you tried seeing what exactly is in os.environ? It is just a dict, you
should be able to print it or return it to the browser and read which
values are set.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail




More information about the Tutor mailing list