Skip to content

use windows compatible filenames #20

Description

@ggggggggg

I tried to run mkdocs serve on Windows 11 with a project with mkdocs-matplotlib and got the below error:

File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\mkdocs_matplotlib\plugin.py", line 48, in _rendered_image_to_dir
    exec(savefig_code, global_namespace, local_namespace)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 2
    plt.savefig("C:\Users\user\AppData\Local\Temp\tmpeahgv9ei.svg", bbox_inches='tight')
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

I'm guessing the issue is the use of \ to generate file paths, does that seem right? If so using pathlib or os.path.join to generate paths may resolve it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions