Skip to content

Commit

Permalink
search for keyfile in sys.path as last resort; reword exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Oct 7, 1995
1 parent 5a6ad8f commit 83d6bbf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Demo/pdist/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ def __init__(self):
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
Expand Down

0 comments on commit 83d6bbf

Please sign in to comment.