copier-org / copier

Library and command-line utility for rendering projects templates.
https://readthedocs.org/projects/copier/
MIT License
2k stars 180 forks source link

Copier copy not working on windows on my maschine #1803

Closed Lorilatschki closed 2 weeks ago

Lorilatschki commented 2 weeks ago

Describe the problem

When running the copier copy template_folder folder_to_copyto we get the following exception:

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:\Users\myuser\.local\bin\copier.exe\__main__.py", line 7, in <module>
    sys.exit(copier_app_run())
             ~~~~~~~~~~~~~~^^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\plumbum\cli\application.py", line 640, in run
    inst, retcode = subapp.run(argv, exit=False)
                    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\plumbum\cli\application.py", line 635, in run
    retcode = inst.main(*tailargs)
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\cli.py", line 281, in main
    return _handle_exceptions(inner)
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\cli.py", line 70, in _handle_exceptions
    method()
    ~~~~~~^^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\cli.py", line 272, in inner
    with self._worker(
         ~~~~~~~~~~~~^
        template_src,
        ^^^^^^^^^^^^^
    ...<3 lines>...
        overwrite=self.force or self.overwrite,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ) as worker:
    ^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\main.py", line 228, in __exit__
    raise value
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\cli.py", line 279, in inner
    worker.run_copy()
    ~~~~~~~~~~~~~~~^^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\main.py", line 827, in run_copy
    self._render_folder(src_abspath)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "C:\Users\myuser\pipx\venvs\copier\Lib\site-packages\copier\main.py", line 691, in _render_folder
    for file in src_abspath.iterdir():
                ~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python313\Lib\pathlib\_local.py", line 575, in iterdir
    with os.scandir(root_dir) as scandir_it:
         ~~~~~~~~~~^^^^^^^^^^
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\Users\\myuser\\AppData\\Local\\Temp\\copier.vcs.clone.qpjv8gd7\\template'

Template

It is a simple template with one question and only one file. This issue is not related to the template at all, it seems to be an issue with python under windows.

To Reproduce

  1. Install python on windows via setup (64-bit). https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe
  2. Install pipx via pip install pipx
  3. Install copier via pipx install copier
  4. Run copier on a simple template via copier copy template_folder folder_to_copyto
  5. I getting the path error mentioned in Describe the problem.

Logs

No response

Expected behavior

Template should be created as expected.

Screenshots/screencasts/logs

No response

Operating system

Windows

Operating system distribution and version

Windows 10 Version 22H2 (Build 19045.4894) x64

Copier version

copier 9.3.1

Python version

Python 3.13.0

Installation method

pipx+pypi

Additional context

No response

Lorilatschki commented 2 weeks ago

It turned out, that we misconfigured our template via a non existing copier.yml entry _subdirectory: template. Thats why we got the path issue.