| skipped 1 lines |
2 | 2 | | from core import config |
3 | 3 | | import ntpath |
4 | 4 | | import traceback |
| 5 | + | from time import sleep |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | class DownloadModuleException(ModuleException): |
| skipped 107 lines |
115 | 116 | | file_open_mode = 'ab' |
116 | 117 | | else: |
117 | 118 | | file_open_mode = 'wb' |
118 | | - | with open(output_path, file_open_mode) as outfile: |
119 | | - | outfile.write(file_content) |
| 119 | + | try: |
| 120 | + | with open(output_path, file_open_mode) as outfile: |
| 121 | + | outfile.write(file_content) |
| 122 | + | except PermissionError: |
| 123 | + | sleep(1) |
| 124 | + | with open(output_path, file_open_mode) as outfile: |
| 125 | + | outfile.write(file_content) |
120 | 126 | | output = "File Downloaded correctly to " + output_path |
121 | 127 | | return output |
122 | 128 | | |
| skipped 57 lines |