os.environ['PATH'] missing

P

peterbe

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
os.environ?
 
J

Jorgen Grahn

On 6 Jan 2006 06:03:05 -0800 said:
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
suppose).

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top