8000 Unhandled exception when symlinking isn't allowed · Issue #4051 · squidfunk/mkdocs-material · GitHub
[go: up one dir, main page]

Skip to content

Unhandled exception when symlinking isn't allowed #4051

@wilhelmer

Description

@wilhelmer

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

See our discussion here.

In summary, if you're working on a Windows machine where symlinking isn't allowed, include the privacy plugin, have assets that require symlinking, and want to build locally, the following exception will be raised:

File "...\Local\Programs\Python\Python310\lib\site-packages\material\plugins\privacy\plugin.py", line 121, in on_post_page
value.replace(raw, self._fetch(url, page)),
File "...\AppData\Local\Programs\Python\Python310\lib\site-packages\material\plugins\privacy\plugin.py", line 217, in _fetch
os.symlink(os.path.basename(file), path)
OSError: [WinError 1314] A required privilege is not held by the client: 'css.css' -> '.cache\\fonts.googleapis.com/css'
The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command mkdocs build" terminated with exit code: 1.

I did more research on this, and it seems the edge case is pretty much on our side. Usually, symlinking should be allowed on Windows, even without admin rights. There's a dedicated user right called "Create symbolic links", which apparently our IT department took away from us, God knows why. You can also enable Windows developer mode to allow symlinking. For more information, see here.

So I think all we need here is exception handling and a warning message explaining that symlinking has to be enabled. (Maybe it can also be disabled on Unix? So it could be useful on any OS.).

Expected behaviour

Actual behaviour

Steps to reproduce

Package versions

  • Python: 3.10
  • MkDocs: 1.3.0
  • Material: 8.3.2+insiders.4.17.2

Configuration

-

System information

  • Operating system: Windows 10
  • Browser: Firefox

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvementresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0