'CommandRunner elevate command is not working with os.symlink (OSError: [WinError 1314])

I am using the command_runner module in order to elevate to admin rights when creating a symlink. I elevate both the main and the os.symlink command

def main():
    """Entry point"""
    elevate(os.symlink("the_source_path", "the_symlink_destination"))


if __name__ == "__main__":
    elevate(main)

However, if my windows command prompt is not started as admin, it does not work:

OSError: [WinError 1314] A required privilege is not held by the client

I am also using the elevate command at an other occasion, to create a file in a windows protected folder, and it works very well here (I elevate only the main).

So I wonder how to fix this particular case ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source