sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Kalle Anke's Avatar

getting the path in a cgi script


Question posted by: Kalle Anke (Guest) on October 14th, 2005 04:45 PM
I know I've done this once before ... I think ... but now I can't figure out
how to do it

I've set my web server to use an alias similar to this

ScriptAlias /xx/ "/Library/WebServer/CGI-Executables/xxx.cgi/"

which makes it possible for me to write

http://127.0.0.1/xx/some/kind/of/path

my problem is that I don't know how to get the 'some/kind/of/path' part of
the URL in my script.

I know that I can do like this in perl

$documentRoot.path_info();

but how do I do it in python?

2 Answers Posted
Fredrik Lundh's Avatar
Guest - n/a Posts
#2: Re: getting the path in a cgi script

Kalle Anke wrote:
[color=blue]
> I know I've done this once before ... I think ... but now I can't figure out
> how to do it
>
> I've set my web server to use an alias similar to this
>
> ScriptAlias /xx/ "/Library/WebServer/CGI-Executables/xxx.cgi/"
>
> which makes it possible for me to write
>
> http://127.0.0.1/xx/some/kind/of/path
>
> my problem is that I don't know how to get the 'some/kind/of/path' part of
> the URL in my script.
>
> I know that I can do like this in perl
>
> $documentRoot.path_info();
>
> but how do I do it in python?[/color]

import os
path_info = os.environ.get("PATH_INFO")

</F>



Kalle Anke's Avatar
Guest - n/a Posts
#3: Re: getting the path in a cgi script

On Fri, 14 Oct 2005 18:20:10 +0200, Fredrik Lundh wrote
(in article <mailman.2074.1129306980.509.python-list@python.org>):
[color=blue]
> import os
> path_info = os.environ.get("PATH_INFO")[/color]

Tackar ... det var nåt enkelt det mindes jag :-)

 
Not the answer you were looking for? Post your question . . .
196,795 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,795 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors