MCPcopy Create free account
hub / github.com/ActiveState/code / get_source

Function get_source

recipes/Python/456374_Crypt/recipe-456374.py:152–164  ·  view source on GitHub ↗

Gets a source file. Gets the file. Handles errors. Returns the file.

(prompt)

Source from the content-addressed store, hash-verified

150 print
151
152def get_source(prompt):
153 '''Gets a source file.
154
155 Gets the file.
156 Handles errors.
157 Returns the file.'''
158 while True:
159 try:
160 source = file(raw_input(prompt + ' '), 'rb')
161 return source
162 except:
163 pass
164 print 'Please enter a different filename.'
165
166def get_key():
167 '''Gets key data.

Callers 3

encode_fileFunction · 0.70
get_keyFunction · 0.70
decode_fileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected