TheGroundZero / openvasreporting

OpenVAS Reporting: Convert OpenVAS XML report files to reports
Other
131 stars 45 forks source link

error when export docx... PermissionError: [WinError 32] The process cannot access the file because it is being used by another process #20

Closed finsysbml closed 3 years ago

finsysbml commented 3 years ago

when exporting "-f docx" returns error:

  File "<base_path_removed>\openvasreporting\libs\export.py", line 545, in export_to_word
    os.remove(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\someuser\\AppData\\Local\\Temp\\tmpbdnxw19g.png'

solution is in libs/export.py to comment out the first "os.remove(path)" in "export_to_word" and add the line "os.close(fd) between the second run_chart... and os.remove(path)... ie ... run_chart.add_picture(path, width=Cm(8.0))

os.remove(path)

... run_chart.add_picture(path, width=Cm(8.0)) os.close(fd) os.remove(path) ...

TheGroundZero commented 3 years ago

Could you send in a Pull Request?

finsysbml commented 3 years ago

Have created my first pull request (I think) - please let me know if anything further required etc. Regards

TheGroundZero commented 3 years ago

I merged the PR.

Thank you for your help :)