Decodes a file. Shows the heading. Gets the source file. Gets the destination file. Handles errors. Gets a key. Does the decoding. Prints a confirmation.
()
| 196 | destination.close() |
| 197 | |
| 198 | def decode_file(): |
| 199 | '''Decodes a file. |
| 200 | |
| 201 | Shows the heading. |
| 202 | Gets the source file. |
| 203 | Gets the destination file. |
| 204 | Handles errors. |
| 205 | Gets a key. |
| 206 | Does the decoding. |
| 207 | Prints a confirmation.''' |
| 208 | show_heading('DECODE FILE') |
| 209 | source = get_source('What is the name of the source file?') |
| 210 | destination = get_destination('What will be the name of the destination file?') |
| 211 | bad_key = True |
| 212 | while bad_key: |
| 213 | try: |
| 214 | key = get_key() |
| 215 | work_decode(source, destination, key) |
| 216 | bad_key = False |
| 217 | except: |
| 218 | print 'Please enter a different filename.' |
| 219 | print 'The decoded file has been created at the location specified.' |
| 220 | |
| 221 | |
| 222 | def work_decode(source, destination, key): |
| 223 | '''Does decoding. |
no test coverage detected