uwestoehr wrote: ↑Thu Oct 10, 2019 12:15 am
...
Code: Select all
os_symlink(source, link_name)
OSError: symbolic link privilege not held
...
Could it be a bug in BoltsFC itself?
...
I cannot reproduce in an Ubuntu Linux system. I tested installing and reinstalling the workbench several times and it worked fine.
Now, the error message you seem to be getting is about symbolic links. Traditionally symbolic links are a feature of Unix systems, but not of Windows. I haven't looked at the code of the Addon Manager so I don't know how it implements this
os_symlink() function. However, I think the problem is probably elsewhere as you said other workbenches install correctly.
If I were to guess, I'd say it's a problem of permissions in Windows.
Privlege error trying to create symlink using python on windows 10
Eryk Sun wrote:
If UAC is enabled and your user is an administrator, then the Local Security Authority (LSA, hosted in lsass.exe) logs your user on with a restricted access token. For this token, the BUILTIN\Administrators group is used only for denying access; the integrity-level label is medium instead of high; and the privileges typically granted to an administrator have been filtered out.
To create a symbolic link, you need to create the process using your unrestricted/elevated access token (i.e. elevated from medium to high integrity level). Do this by right-clicking and selecting "Run as administrator". This elevated token will be inherited by child processes, so it suffices to run your Python script from an elevated command prompt, which you can open via the keyboard shortcut Win+X A. You can verify that the cmd shell is elevated by running whoami /priv and checking for the presence of SeCreateSymbolicLinkPrivilege. Don't be alarmed if the state is disabled. The Windows CreateSymbolicLink function automatically enables this privilege.
That said, since you're creating a directory symbolic link, then perhaps a junction will work just as well. No special privilege is required to create a junction. You can create a junction using cmd's mklink command. For example:
subprocess.check_call('mklink /J "%s" "%s"' % (link, target), shell=True)
Maybe the Addon Manager needs to be modified a bit to handle symbolic links better in Windows.