arcsikex / cascadeur_bridge

This Blender addon is aimed to help you integrate Cascadeur into your workflow.
GNU General Public License v3.0
277 stars 12 forks source link

try to fix PermissionError: [WinError 5] Access is denied #28

Closed catafest closed 11 months ago

catafest commented 11 months ago

Describe the bug A clear and concise description of what the bug is.

Python: Traceback (most recent call last): File "C:\Users\catafest\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\cascadeur_bridge\operators\csc_ops.py", line 21, in execute CascadeurHandler().start_cascadeur() File "C:\Users\catafest\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\cascadeur_bridge\utils\csc_handling.py", line 55, in start_cascadeur subprocess.Popen([csc_path]) File "C:\blender-4.0.0-alpha+main.3f90bb6a48d2-windows.amd64-release\4.0\python\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\blender-4.0.0-alpha+main.3f90bb6a48d2-windows.amd64-release\4.0\python\lib\subprocess.py", line 1456, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, PermissionError: [WinError 5] Access is denied

Steps to reproduce the behavior:

  1. I follow the steps from your video, and when I press the Cascadeur button I got the error.
  2. the cascadeur is installed in AppData\Local\Cascadeur https://www.youtube.com/watch?v=0muo9EPIPSE

Environment:

Additional context Add any other context about the problem here.

I think the access folder can be fixed with :

import os
import stat
import shutil

def change_folder_permissions(folder_path):
    try:
        # Get current permissions
        current_permissions = os.stat(folder_path).st_mode

        # Set new permissions (Full control for the current user)
        new_permissions = current_permissions | stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC

        # Apply new permissions
        os.chmod(folder_path, new_permissions)
        print(f"Folder permissions for '{folder_path}' have been changed.")
    except OSError as e:
        print(f"Failed to change permissions: {e}")
arcsikex commented 11 months ago

Thank you for the report and the possible solution. Can you maybe share what were the original permissions set for the Cascadeur folder?

catafest commented 11 months ago

Ok, I think I understand where can be an issue, these are my permissions for a default install Cascadeur folder ... I'm not very good with Windows management issues, any idea?

\AppData\Local>icacls Cascadeur
Cascadeur NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
          BUILTIN\Administrators:(I)(OI)(CI)(F)
          DESKTOP-L6HH19G\catafest:(I)(OI)(CI)(F)

Successfully processed 1 files; Failed processing 0 files
catafest commented 11 months ago

Thank you for your help ... a good idea to have this addon.

I try to fix permissions for both Cascadeur and Blender 3D with this command and not work and I try both normal user and admin ... from the command prompt. icacls "C:\path\to\Cascadeur" /grant MYUSER:(OI)(CI)F Maybe the Blender cannot run this: hp, ht, pid, tid = _winapi.CreateProcess(executable, args, PermissionError: [WinError 5] Access is denied

I need to open an issue on the Blender 3D software but I'm not the owner of this project. The Blender team found a similar issue on this.

Also, I cannot close this issue with this comment ...

arcsikex commented 11 months ago

@catafest sorry I am also not familiar with permissions management. Although I noticed that I also get PermissionError WinError 5 if the cascader.exe path is incorrect. So unfortunately based on the error it's not clear if it's actually a PermissionError or user error. And I'm also not very confident messing with user permission with the addon 😄 I will close the issue, I hope you can find a solution