mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
search for keyfile in sys.path as last resort; reword exception
This commit is contained in:
parent
5a6ad8fb71
commit
83d6bbf597
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue