cs01/create-python-package

fails on windows

zarlo opened this issue · 3 comments

zarlo commented
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32

full console log

python -m pipx run create-python-package     
  create-python-package is already on your PATH and installed at D:\Projects\Tools\Python3\Scripts\create-python-package.EXE. Downloading and running anyway.
Assuming app is 'create-python-package.exe' (Windows only)
Using template https://github.com/cs01/cookiecutter-pypackage5h
You've downloaded C:\Users\[user]\.cookiecutters\cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]:
full_name [First Last]: zarlo
email [email@example.com]: 5899@zarlo.dev
github_username [GitHubUser]: zarlo
project_name [Python Project]: sandboxre
project_short_description []:
pypi_username [zarlo]:
version [0.1.0]:
Select command_line_interface:
1 - argparse
2 - No command-line interface
Choose from 1, 2 [1]: 2
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 2
Traceback (most recent call last):
  File "C:\Users\[user]\AppData\Local\Temp\tmp4nr5gbg4.py", line 17, in <module>
    remove_file(cli_file)
  File "C:\Users\[user]\AppData\Local\Temp\tmp4nr5gbg4.py", line 9, in remove_file
    os.remove(os.path.join(PROJECT_DIRECTORY, filepath))
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:\\Projects\\Github\\zarlo\\sandbox.py\\sandboxre\\sandboxre\\cli.py'
Stopping generation because post_gen_project hook script didn't exit successfully
Traceback (most recent call last):
  File "D:\Projects\Tools\Python3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Projects\Tools\Python3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\[user]\.local\pipx\.cache\9e1584308bc335a\Scripts\create-python-package.exe\__main__.py", line 7, in <module>
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\createpythonpackage\main.py", line 29, in main
    cookiecutter(args.template)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\main.py", line 94, in cookiecutter
    output_dir=output_dir
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 376, in generate_files
    delete_project_on_failure
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 236, in _run_hook_from_repo_dir
    run_hook(hook_name, project_dir, context)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 145, in run_hook
    run_script_with_context(script, project_dir, context)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 129, in run_script_with_context
    run_script(temp.name, cwd)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 91, in run_script
    'Hook script failed (exit status: {})'.format(exit_status)
cookiecutter.exceptions.FailedHookException: Hook script failed (exit status: 1)
cs01 commented

Thanks for reporting!

Fixed in cs01/cookiecutter-pypackage@991f5b3.

Try running again and make sure you answer yes here:

You've downloaded /Users/user/.cookiecutters/cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]:
zarlo commented

its now

python -m pipx run create-python-package
  create-python-package is already on your PATH and installed at D:\Projects\Tools\Python3\Scripts\create-python-package.EXE. Downloading and running anyway.
Assuming app is 'create-python-package.exe' (Windows only)
Using template https://github.com/cs01/cookiecutter-pypackage
You've downloaded C:\Users\[user]\.cookiecutters\cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]: yes
full_name [First Last]: zarlo
email [email@example.com]: 5899@zarlo.dev
github_username [GitHubUser]: zarlo
project_name [Python Project]: sandboxre
project_slug [sandboxre]:
project_short_description []:
pypi_username [zarlo]:
version [0.1.0]:
Select command_line_interface:
1 - argparse
2 - No command-line interface
Choose from 1, 2 [1]: 2
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 2
Traceback (most recent call last):
  File "C:\Users\[user]\AppData\Local\Temp\tmpaxf77meh.py", line 26, in <module>
    subprocess.run(["black", PROJECT_DIRECTORY, "--quiet"])
  File "D:\Projects\Tools\Python3\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "D:\Projects\Tools\Python3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "D:\Projects\Tools\Python3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Stopping generation because post_gen_project hook script didn't exit successfully
Traceback (most recent call last):
  File "D:\Projects\Tools\Python3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Projects\Tools\Python3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\[user]\.local\pipx\.cache\9e1584308bc335a\Scripts\create-python-package.exe\__main__.py", line 7, in <module>
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\createpythonpackage\main.py", line 29, in main
    cookiecutter(args.template)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\main.py", line 94, in cookiecutter
    output_dir=output_dir
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 376, in generate_files
    delete_project_on_failure
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 236, in _run_hook_from_repo_dir
    run_hook(hook_name, project_dir, context)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 145, in run_hook
    run_script_with_context(script, project_dir, context)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 129, in run_script_with_context
    run_script(temp.name, cwd)
  File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 91, in run_script
    'Hook script failed (exit status: {})'.format(exit_status)
cookiecutter.exceptions.FailedHookException: Hook script failed (exit status: 1)
cs01 commented

Sorry about that. Fixed in cs01/cookiecutter-pypackage@abcac39. I will leave this open and let you close if it is fixed.