profile
viewpoint

Ask questionsCannot create "GitHub->cookiecutter-flask/cookiecutter-flask" template in cookiecutter

VS Version: 16.5.0 Preview 2.0 [29601.8.master] Python Tool Version: 16.5.19318.1

Steps to Reproduce

  1. Launch VS
  2. Click "View->Cookiecutter Explorer"
  3. Select "GitHub->cookiecutter-flask/cookiecutter-flask" to click "Next"
  4. Wait for load successfully and then click "Create and Open Folder"

Expected behavior It should create successfully

Additional context and screenshots Error occurs when create template image

Note "GitHub->italomaia/flask-empty" is repro

Error detail info ----- Cloning template 'cookiecutter-flask/cookiecutter-flask' ----- warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. Cloning into 'cookiecutter-flask'... warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'. For security reasons, it is therefore ignored. To fix this, please transfer ownership to an admininstrator. ----- Successfully cloned template 'cookiecutter-flask/cookiecutter-flask' to 'C:\Users\vxiaofz.cookiecutters\cookiecutter-flask' ----- ----- Loading template 'cookiecutter-flask/cookiecutter-flask' ----- {"cookiecutter": {"full_name": "Steven Loria", "email": "sloria1@gmail.com", "github_username": "sloria", "project_name": "My Flask App", "app_name": "{{cookiecutter.project_name.lower().replace('-', '').replace(' ', '')}}", "project_short_description": "A flasky app.", "use_pipenv": ["no", "yes"], "python_version": ["3.8", "3.7", "3.6"], "node_version": ["12", "10"], "use_heroku": ["no", "yes"]}} ----- Successfully loaded template 'cookiecutter-flask/cookiecutter-flask' -----

----- Creating files using template 'cookiecutter-flask/cookiecutter-flask' ----- DEBUG main.py: context_file is C:\Users\vxiaofz.cookiecutters\cookiecutter-flask\cookiecutter.json DEBUG generate.py: Context generated is {'cookiecutter': OrderedDict([('full_name', 'Steven Loria'), ('email', 'sloria1@gmail.com'), ('github_username', 'sloria'), ('project_name', 'My Flask App'), ('app_name', "{{cookiecutter.project_name.lower().replace('-', '').replace(' ', '')}}"), ('project_short_description', 'A flasky app.'), ('use_pipenv', ['no', 'yes']), ('python_version', ['3.8', '3.7', '3.6']), ('node_version', ['12', '10']), ('use_heroku', ['no', 'yes'])])} DEBUG utils.py: Making sure path exists: C:\Users\vxiaofz/.cookiecutter_replay/ DEBUG find.py: Searching C:\Users\vxiaofz.cookiecutters\cookiecutter-flask for the project template. DEBUG find.py: The project template appears to be C:\Users\vxiaofz.cookiecutters\cookiecutter-flask{{cookiecutter.app_name}} DEBUG generate.py: Generating project from C:\Users\vxiaofz.cookiecutters\cookiecutter-flask{{cookiecutter.app_name}}... DEBUG generate.py: Rendered dir my_flask_app must exist in output_dir C:\Users\vxiaofz\AppData\Local\Temp\482fc677-f089-490a-a551-059d6467543c DEBUG utils.py: Making sure path exists: C:\Users\vxiaofz\AppData\Local\Temp\482fc677-f089-490a-a551-059d6467543c\my_flask_app DEBUG generate.py: project_dir is C:\Users\vxiaofz\AppData\Local\Temp\482fc677-f089-490a-a551-059d6467543c\my_flask_app DEBUG hooks.py: hooks_dir is hooks Traceback (most recent call last): File "C:\Users\vxiaofz\AppData\Local\Temp\tmptlbiz_cm.py", line 41, in <module> from hooks.utils import log_module_name_warning ModuleNotFoundError: No module named 'hooks' ERROR generate.py: Stopping generation because pre_gen_project hook script didn't exit sucessfully Traceback (most recent call last): File "c:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\cookiecutter\cookiecutter_run.py", line 46, in <module> sys.exit(int(main() or 0)) File "c:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\cookiecutter\cookiecutter_run.py", line 42, in main config_file=user_config_path, File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\main.py", line 144, in cookiecutter output_dir=output_dir File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\generate.py", line 285, in generate_files _run_hook_from_repo_dir(repo_dir, 'pre_gen_project', project_dir, context) File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\generate.py", line 233, in _run_hook_from_repo_dir run_hook(hook_name, project_dir, context) File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\hooks.py", line 114, in run_hook run_script_with_context(script, project_dir, context) File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\hooks.py", line 99, in run_script_with_context run_script(temp.name, cwd) File "C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\lib\site-packages\cookiecutter\hooks.py", line 76, in run_script "Hook script failed (exit status: %d)" % exit_status) cookiecutter.exceptions.FailedHookException: Hook script failed (exit status: 1) C:\Users\vxiaofz\AppData\Local\Microsoft\CookiecutterTools\env\scripts\python.exe returned an exit code of 1. ----- Failed to create files using template 'cookiecutter-flask/cookiecutter-flask' -----

microsoft/PTVS

Answer questions huguesv

I get the same error ModuleNotFoundError: No module named 'hooks' when using cookiecutter from command line with that template, so I believe this may be an issue with the template itself and unrelated to VS.

useful!
source:https://uonfu.com/
Github User Rank List