summaryrefslogtreecommitdiffstats
path: root/Demo/pdist/security.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-10-07 19:35:07 (GMT)
committerGuido van Rossum <guido@python.org>1995-10-07 19:35:07 (GMT)
commit83d6bbf5974adcb3292c4f498651c073db306b8b (patch)
tree55f1596d698076a3782650e6cb09941949a5e951 /Demo/pdist/security.py
parent5a6ad8fb71501ec050f5ab6dac2763da0bf1f89e (diff)
downloadcpython-83d6bbf5974adcb3292c4f498651c073db306b8b.zip
cpython-83d6bbf5974adcb3292c4f498651c073db306b8b.tar.gz
cpython-83d6bbf5974adcb3292c4f498651c073db306b8b.tar.bz2
search for keyfile in sys.path as last resort; reword exception
Diffstat (limited to 'Demo/pdist/security.py')
-rwxr-xr-xDemo/pdist/security.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Demo/pdist/security.py b/Demo/pdist/security.py
index a11294a..f993682 100755
--- a/Demo/pdist/security.py
+++ b/Demo/pdist/security.py
@@ -9,10 +9,17 @@ class Security:
keyfile = '.python_keyfile'
if env.has_key('HOME'):
keyfile = os.path.join(env['HOME'], keyfile)
+ if not os.path.exists(keyfile):
+ import sys
+ for dir in sys.path:
+ kf = os.path.join(dir, keyfile)
+ if os.path.exists(kf):
+ keyfile = kf
+ break
try:
self._key = eval(open(keyfile).readline())
except IOError:
- raise IOError, "python keyfile %s not found" % keyfile
+ raise IOError, "python keyfile %s: cannot open" % keyfile
def _generate_challenge(self):
import whrandom