jdoiro3 / mkdocs-multirepo-plugin

Build documentation in multiple repos into one site.
MIT License
132 stars 47 forks source link

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process #114

Open navi771 opened 1 year ago

navi771 commented 1 year ago

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process

after Run Mkdocs serve getting error which is mention on above

ttutuncu commented 1 year ago

I am getting the same error too running on windows. I tried restarting my computer and running on seperate terminals. I had no issues prior to installing this plugin, I was able to serve the documentation perfectly. I am sharing the log and my mkdocs.yml configuration below. Would appreciate any help here.

PS C:\Projects\Documentation> mkdocs build
INFO    -  DeprecationWarning: warning_filter doesn't do anything since MkDocs 1.2 and will be removed soon. All messages on the `mkdocs` logger get counted automatically.
             File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\util.py", line 10, in <module>
               from mkdocs.utils import warning_filter
             File "C:\Python311\Lib\site-packages\mkdocs\utils\__init__.py", line 453, in __getattr__
               warnings.warn(
INFO    -  MERMAID2  - Initialization arguments: {'theme': '^(JSON.parse(__md_get("__palette").index == 1)) ? \'dark\' : \'light\'\n'}
INFO    -  MERMAID2  - Using javascript library (10.4.0):
              https://unpkg.com/mermaid@10.4.0/dist/mermaid.esm.min.mjs
INFO    -  Multirepo plugin importing docs...
🔳 external\microservice
Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\mkdocs\commands\build.py", line 277, in build
    config = config.plugins.on_config(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs\plugins.py", line 527, in on_config
    return self.run_event('config', config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs\plugins.py", line 507, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\plugin.py", line 310, in on_config
    config = self.handle_nav_import(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\plugin.py", line 180, in handle_nav_import
    asyncio_run(batch_import(repos, keep_docs_dir=keep_docs_dir))
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\util.py", line 114, in asyncio_run
    asyncio.run(futures)
  File "C:\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 424, in batch_import
    await batch_execute(
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 416, in batch_execute
    repo = await future
           ^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\tasks.py", line 605, in _wait_for_one
    return f.result()  # May raise f.exception().
           ^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 385, in import_docs
    await self.sparse_clone([docs_dir, self.config] + self.extra_imports)
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\structure.py", line 193, in sparse_clone
    await execute_bash_script("sparse_clone.sh", args, self.temp_dir)
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\util.py", line 108, in execute_bash_script
    raise BashException(f"\n{stderr}\n")
mkdocs_multirepo_plugin.util.BashException:

During handling of the above exception, another exception occurred:

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:\Python311\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
  File "C:\Python311\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs\__main__.py", line 286, in build_command
    build.build(cfg, dirty=not clean)
  File "C:\Python311\Lib\site-packages\mkdocs\commands\build.py", line 365, in build
    config.plugins.on_build_error(error=e)
  File "C:\Python311\Lib\site-packages\mkdocs\plugins.py", line 545, in on_build_error
    return self.run_event('build_error', error=error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs\plugins.py", line 509, in run_event
    result = method(**kwargs)
             ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\mkdocs_multirepo_plugin\plugin.py", line 359, in on_build_error
    shutil.rmtree(str(self.temp_dir))
  File "C:\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\shutil.py", line 626, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\Python311\Lib\shutil.py", line 624, in _rmtree_unsafe
    os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Projects\\Documentation\\temp_dir'

mkdocs.yml

site_name: xxx

theme: 
  name: material
  language: tr
  highlightjs: true
  features:
   - navigation.tracking
   - navigation.tabs
   - navigation.sections
   - navigation.expand
   - navigation.path
   - navigation.indexes
   - navigation.top
   - search.suggest
   - search.highlight
   - content.tabs.link
   - content.code.annotation
   - content.code.copy
   - header.autohide
extra:
  homepage: /
  generator: false 
markdown_extensions:
  - pymdownx.highlight
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.caret
  - pymdownx.critic
  - pymdownx.smartsymbols
  - admonition
  - footnotes
  - pymdownx.details
  - toc:
      permalink: true
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid_custom
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.magiclink
  - pymdownx.keys
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.tasklist
  - attr_list
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
plugins:
  - search
  - badges
  - mermaid2:
      version: 10.4.0 #10.4.0 latest / 9.4.3
  - swagger-ui-tag:
      tryItOutEnabled: true
      syntaxHighlightTheme: monokai
  - git-revision-date-localized
  - multirepo:
      cleanup: true
      keep_docs_dir: true

exclude_docs: |
  /requirements.txt  # Top-level "docs/requirements.txt".
  *.sh               # Any file with this extension anywhere.

validation:
  omitted_files: warn
  absolute_links: warn
  unrecognized_links: warn
  nav:
    omitted_files: info
    not_found: warn
    absolute_links: info
  links:
    not_found: warn
    absolute_links: info
    unrecognized_links: info

nav:
  - External:
    #- FastAPI: fast-api/docs/en/docs/index.md
    - MicroService: '!import {https://github.com/bootstrap}?branch={feature/small-adaptations}&docs_dir={docs/*}&multi_docs={True}&config={mkdocs}.yml&keep_docs_dir={True}'