Skip to content

When "profiles.xlsx" (or another file to be overwritten) is open (i.e., impossible to overwrite), saving fails

When "profiles.xlsx" is open in Excel, clicking "Apply" in the profile fusion window closes it without saving anything (potentially losing the "map this to that" configuration which the user entered).

Ideally, if the output file cannot be overwritten, either a warning message should pop up and the profile fusion window should stay open, or the user should be able to select a different file name.

In debug mode, the fail goes with this traceback:

Traceback (most recent call last):
  File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\app.py", line 515, in execute_general_action_or_show_settings
    self.execute_general_action(action)
  File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\app.py", line 524, in execute_general_action
    action(self.state, self.action_context)
  File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\plugins\profile_register\general\profile_registering.py", line 70, in __call__
    self._execute(state, _)
  File "D:\work\arthropods\arthropoddescriber2repository\arthropod_describer_py\maphis\plugins\profile_register\general\profile_registering.py", line 128, in _execute
    wb.save(worksheet_path)
  File "C:\Users\Karel\miniconda3\envs\arth2\lib\site-packages\openpyxl\workbook\workbook.py", line 407, in save
    save_workbook(self, filename)
  File "C:\Users\Karel\miniconda3\envs\arth2\lib\site-packages\openpyxl\writer\excel.py", line 291, in save_workbook
    archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True)
  File "C:\Users\Karel\miniconda3\envs\arth2\lib\zipfile.py", line 1251, in __init__
    self.fp = io.open(file, filemode)
PermissionError: [Errno 13] Permission denied: 'C:\\MAPHIS\\Projects\\TutorialProject\\registered_profiles\\profiles.xlsx'

Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)