Skip to content

Handle missing file access permissions more gracefully? #78

Description

@Dragorn421

When an addon is mistakenly installed under a Blender installation folder which happens to be under C:\Program Files\, the updater addon will eventually raise an error during registering due to not having write access to the filesystem there

I'm using an old version of the updater addon but looking at current code this is probably still relevant. Sorry if it got addressed and I should just bother updating, lazy me

Here's the trace

io_export_objex2 updater verbose is enabled
Exception in module register(): C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\__init__.py
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\addon_utils.py", line 382, in enable
    mod.register()
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\__init__.py", line 564, in register
    addon_updater_ops.register(bl_info)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\addon_updater_ops.py", line 1509, in register
    showReloadPopup()
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\addon_updater_ops.py", line 835, in showReloadPopup
    saved_state = updater.json
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\addon_updater.py", line 298, in json
    self.set_updater_json()
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_export_objex2\addon_updater.py", line 1467, in set_updater_json
    os.makedirs(self._updater_path)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\python\lib\os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Blender Foundation\\Blender 2.91\\2.91\\scripts\\addons\\io_export_objex2\\io_export_objex2_updater'

Since this halts the registering, the addon doesn't unregister either and further registering attempts (eg by the user clicking the "enable addon" checkbox again) raise misleading errors about already-registered classes.

I think it would be nice to have the autoupdater handle "no file write permission" more gracefully. Maybe it should just disable itself and draw a message about "installed in the wrong directory, don't have write permissions" in the addon properties where the updater properties would be?

I can take care of PRing the necessary changes, I just want to find what the best way to handle this is first

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions