Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: File path separator is not working properly on Windows and throws exception #164

Open
nothingspecial123 opened this issue Oct 24, 2024 · 0 comments

Comments

@nothingspecial123
Copy link

Hello,

I'm using the latest version of multirepo-plugin on Windows 11.
The project uses poetry, mkdocs, mike plugins.

When use poetry run mkdocs serve command, I get an ImportDocsException. The .deps folder is created temporarily, but the structure of the folders is incorrect. (folder1folder2subfolder instead of folder1/folder2/subfolder)
I think something went wrong during the cloning of a git repo.

Traceback:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\myproject\webpage-3\myvirtualenvironment\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
    sys.exit(cli())
             ~~~^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\__main__.py", line 268, in serve_command
    serve.serve(**kwargs)
    ~~~~~~~~~~~^^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\commands\serve.py", line 85, in serve
    builder(config)
    ~~~~~~~^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\commands\serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\commands\build.py", line 265, in build
    config = config.plugins.on_config(config)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\plugins.py", line 587, in on_config
    return self.run_event('config', config)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs\plugins.py", line 566, in run_event
    result = method(item, **kwargs)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs_multirepo_plugin\plugin.py", line 310, in on_config
    config = self.handle_nav_import(config)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs_multirepo_plugin\plugin.py", line 184, in handle_nav_import
    repo_config = repo.load_config()
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 400, in load_config
    config = super().load_config(self.config)
  File "C:\myproject\webpage-3\myvirtualenvironment\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 217, in load_config
    raise ImportDocsException("docs must be imported before loading yaml")
mkdocs_multirepo_plugin.util.ImportDocsException: docs must be imported before loading yaml

I can't find anything about ImportDocsException on the net. I don't think others encountered a similar error.

After debugging, I changed this line:

args = [self.url, self.name, self.branch] + paths

to

args = [self.url, self.name.replace(os.sep, '/'), self.branch] + paths

and the content from the git repos is downloaded correctly with the good folder structure. So the poetry run mkdocs serve command is run properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant