Skip to content

Unicode paths break clean_directory on server #1516

Closed

Description

@waylan

Discovered a weird error with the server and Unicode characters in paths. Run the following command and everything seems fine:

mkdocs serve -f mkdocs/tests/integration/unicode/mkdocs.yml

However, once a file is edited and saved, the second attempt at a build results in the following error:

Exception in callback <bound method type.poll_tasks of <class 'livereload.handlers.LiveReloadHandler'>>
    Traceback (most recent call last):
      File "/Users/waylan/VirtualEnvs/mkdocs/lib/python2.7/site-packages/tornado/ioloop.py", line 1209, in _run
        return self.callback()
      File "/Users/waylan/VirtualEnvs/mkdocs/lib/python2.7/site-packages/livereload/handlers.py", line 67, in poll_tasks
        filepath, delay = cls.watcher.examine()
      File "/Users/waylan/VirtualEnvs/mkdocs/lib/python2.7/site-packages/livereload/watcher.py", line 73, in examine
        func and func()
      File "/Users/waylan/Code/mkdocs/mkdocs/commands/serve.py", line 112, in builder
        build(config, live_server=live_server, dirty=dirty)
      File "/Users/waylan/Code/mkdocs/mkdocs/commands/build.py", line 265, in build
        utils.clean_directory(config['site_dir'])
      File "/Users/waylan/Code/mkdocs/mkdocs/utils/__init__.py", line 144, in clean_directory
        if entry.startswith('.'):
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 1: ordinal not in range(128)

It would seem that somewhere between the call to utils.clean_directory(config['site_dir']) on the first build, and the same call on the second build, the site_dir config setting is converted from a Unicode string to a byte string.

I'm assuming the server code is the culprit.

Activity

  1. added this to the 1.0.0 milestone on Jun 24, 2018
  2. added 2 commits that reference this issue on Jun 24, 2018
    98bd042
    b8fa643
  3. added a commit that references this issue on Jun 29, 2018
    0a28707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions