Executes decoding subsection. Shows the heading of this area. Gets the source file for encoding. Gets the destination file. Handles errors. Gets a key. Executes the main encoding system. Prints a confirmation.
()
| 126 | return key |
| 127 | |
| 128 | def encode_file(): |
| 129 | '''Executes decoding subsection. |
| 130 | |
| 131 | Shows the heading of this area. |
| 132 | Gets the source file for encoding. |
| 133 | Gets the destination file. |
| 134 | Handles errors. |
| 135 | Gets a key. |
| 136 | Executes the main encoding system. |
| 137 | Prints a confirmation.''' |
| 138 | show_heading('ENCODE FILE') |
| 139 | source = get_source('What is the name of the source file?') |
| 140 | destination = get_destination('What will be the name of the destination file?') |
| 141 | bad_key = True |
| 142 | while bad_key: |
| 143 | try: |
| 144 | key = get_key() |
| 145 | work_encode(source, destination, key) |
| 146 | bad_key = False |
| 147 | except: |
| 148 | print 'Please enter a different filename.' |
| 149 | print 'The encoded file has been created at the location specified.' |
| 150 | |
| 151 | |
| 152 | def get_source(prompt): |
| 153 | '''Gets a source file. |
no test coverage detected