pyptlib.util.checkClientMode prints ENV-ERROR without raising EnvError
You get two ENV-ERROR lines on stdout when you use pyptlib.util.checkClientMode
and pyptlib.server.init
to try to implement a server-only transport, and no environment variables are set:
if pyptlib.util.checkClientMode():
print >> sys.stderr, "This is only a server."
sys.exit(1)
try:
info = pyptlib.server.init(["transport"])
except pyptlib.config.EnvError, e:
print >> sys.stderr, "pyptlib.server.init: %s" % e
sys.exit(1)
The output of this is:
ENV-ERROR Missing environment variable TOR_PT_STATE_LOCATION
ENV-ERROR Missing environment variable TOR_PT_STATE_LOCATION
pyptlib.server.init: Missing environment variable TOR_PT_STATE_LOCATION
I guess if checkClientMode
is going to be checking environment variables, I would like to catch EnvError
when I call that function.