Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Error access Denied #17

Open
finepointcgi opened this issue Dec 17, 2018 · 7 comments
Open

Permission Error access Denied #17

finepointcgi opened this issue Dec 17, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@finepointcgi
Copy link

finepointcgi commented Dec 17, 2018

Im running into a issue with opening up an addon im upgrading. I run blender run and it wont run in blender even when I run VS code as admin. Here is my log.

Executing task: c:\Users\fp\Downloads\blender-2.80-ea33b90a1bf-win64\blender-2.80.0-git.ea33b90a1bf-windows64\blender.exe --python C:\Users\fp.vscode\extensions\jacqueslucke.blender-development-0.0.10\pythonFiles\launch.py <

found bundled python: c:\Users\fp\Downloads\blender-2.80-ea33b90a1bf-win64\blender-2.80.0-git.ea33b90a1bf-windows64\2.80\python
Traceback (most recent call last):
  File "C:\Users\fp\.vscode\extensions\jacqueslucke.blender-development-0.0.10\pythonFiles\launch.py", line 16, in <module>
    allow_modify_external_python=os.environ['ALLOW_MODIFY_EXTERNAL_PYTHON'] == "yes",
  File "C:\Users\fp\.vscode\extensions\jacqueslucke.blender-development-0.0.10\pythonFiles\include\blender_vscode\__init__.py", line 14, in startup
    path_mappings = load_addons.setup_addon_links(addon_paths)
  File "C:\Users\fp\.vscode\extensions\jacqueslucke.blender-development-0.0.10\pythonFiles\include\blender_vscode\load_addons.py", line 20, in setup_addon_links
    create_link_in_user_addon_directory(source_path, load_path)
  File "C:\Users\fp\.vscode\extensions\jacqueslucke.blender-development-0.0.10\pythonFiles\include\blender_vscode\load_addons.py", line 39, in create_link_in_user_addon_directory
    os.remove(link_path)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\fp\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\addons\\MB-Lab-master'
Saved session recovery to 'C:\Users\fp\AppData\Local\Temp\quit.blend'
@Lynchon83
Copy link

I had the same problem, try to remove your addon from blender before launching blender from vscode.

@ghost
Copy link

ghost commented Aug 6, 2020

Oh, ffs!

I wasted hours on this before finding your post.
Well spotted... thank you!

@beqjanus
Copy link

The underlying issue here is arguably not a problem with the vscode addon but with the Blender upgrade process.
Whenever you instal a new version the options to bring over your existing settings is offered and most of us tend to accept that. As @Lynchon83 notes above, removing your VSCode managed blender addons before doing the upgrade circumvents the issue but this is side-stepping the underlying issue.

When you add an addon using the VSCode addon, a link is created in the %AppData%\Bledner Foundation\Blender<version>\scripts\addons folder. You can see this in the folder view of an explorer window (here showing my addon SLender alongside speedflow)
image

During an upgrade this "link" is not maintained, instead a deep copy is made and when the addon tries to alter this things go pear-shaped.

Workarounds are:

  1. remove the addons you are developing before upgrading (as above)
  2. remove the folders that were copied over after the upgrade and then re-install the addon through vscode

I have added a task to the blender dev site, though whether the impact of this (just those of us using this extension) justifies the effort to change Blender upgrade behaviour is questionable, I figured it was worth raising in case there are other use cases where this might cause issues. https://developer.blender.org/T95208

It is interesting that @JacquesLucke used the _winapi.CreateJunctionPoint API call rather than a symlink, not sure that this would make any difference or whether there are other side effects if I were to change that and make a PR.

@EvanAW
Copy link

EvanAW commented Jan 26, 2022

@beqjanus #55 might give you some hints on how to go about solving this issue.

@beqjanus
Copy link

Thanks @EvanAW , my blender bug report was closed as "not a bug" which is probably fair though arguable as to whether silently converting lnks to copies is "expected behaviour". In any case, trying to fix it here is going to be the better direction.

The atexit() handler idea is ok but I agree with @JacquesLucke that (for my workflow) I'd like the links to persist., so perhaps making that optional. A vscode setting that makes link retention/removal a user preference.

One option for this bug is to improve the error reporting. It doesn't fix it but helps people solve the problem themselves.

@kents00
Copy link

kents00 commented Nov 25, 2023

When creating your own addon, it is important to ensure that you do not include the .git file during installation. I discovered this while tracing my own addon and found that including the .git file can cause errors when attempting to remove your addon. If you encounter any issues with removal, you can also try launching Blender in administrator mode.

@Mateusz-Grzelinski
Copy link
Collaborator

Part of the issues related to Permission error were addressed in version [0.0.22] - 2024-09-04, but some corner cases are still worked in in #184 - but the design is not obvious and fixing all corner cases required changing default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants