[Web-SIG] IIS 6.0 Trouble With "os.getcwd()"

Sean K. Friese skfriese at gmail.com
Mon Oct 17 18:13:45 CEST 2005


Works great!  Thanks!

-----Original Message-----
From: web-sig-bounces+skfriese=gmail.com at python.org
[mailto:web-sig-bounces+skfriese=gmail.com at python.org] On Behalf Of anoop
aryal
Sent: Monday, October 17, 2005 11:06 AM
To: web-sig at python.org
Subject: Re: [Web-SIG] IIS 6.0 Trouble With "os.getcwd()"

On Monday 17 October 2005 09:57 am, Sean K. Friese wrote:
> Greetings!
>  Anyone encounter an issue when using "os.getcwd()" in a Python CGI script
> called from an IIS 6.0 box?
>  Apparently the only thing that is ever returned is the root of the
virtual
> directory the script is in. No matter how deep the script is nestled,
> you'll never end up with the actual current working directory of the
> script. This kills two of my apps that I'm migrating to version 6.0 so
far.
> It appears to be broken, but then again, with my limited experience in IIS
> 6.0, there *could* be some setting in there that is causing this, but I
> doubt it. Is there a workaround, or alternatively, is there another way to
> get the current working directory of the script being requested? I've
tried
> a few things, but can't find something that is as "portable", without
> hardcoding at least one string somewhere!

try:

os.path.abspath(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))

anoop.

>  Thanks in advance!

> -Sean K. Friese
_______________________________________________
Web-SIG mailing list
Web-SIG at python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe:
http://mail.python.org/mailman/options/web-sig/skfriese%40gmail.com



More information about the Web-SIG mailing list