469,323 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

os.environ['PATH'] missing

This is a hard question to ask because I can't reproduce the problem
other than restarting several times over until it happens again.

I'm using Zope and Plone for a website on this debian linux vserver and
when I restart it it runs some /etc/init.d/zope restart scripts and
things fail in zope because somewhere deep in there the following
raises an AttributeError that 'PATH' doesn't exist:

foo = os.environ['PATH']

How can it not be present?
What might cause this seemingly random situation?

Has anybody had similar experiences where 'PATH' is not present in

Jan 7 '06 #1
1 2212
On 6 Jan 2006 06:03:05 -0800, pe*****@gmail.com <pe*****@gmail.com> wrote:
How can it not be present?
What might cause this seemingly random situation?

Well, it's not uncommon to start a program with a reduced set of environment
variables, including a limited, hardcoded $PATH, so something like
os.system("ls") cannot be tricked to run an ls outside the
system-controlled, "safe" directories.

On my machine, "env -i sh" starts a shell without $PATH. Bash seems to
default to a builtin search path in that situation (/bin and /usr/bin, I

But reducing $PATH is one thing (and fairly common); removing it is another.
And I'm not sure that programs are expected to cope with the absence of
$PATH; just because it's /possible/ to remove it doesn't mean it's legal.

I don't know anything about web servers and Zope. Sorry.


// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
Jan 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Fernando Rodriguez | last post: by
3 posts views Thread by andrea_gavana | last post: by
2 posts views Thread by eight02645999 | last post: by
10 posts views Thread by mirandacascade | last post: by
9 posts views Thread by boris.smirnov | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.