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

Empty hook file causes cryptic error #632

Closed
christianmlong opened this issue Feb 5, 2016 · 3 comments
Closed

Empty hook file causes cryptic error #632

christianmlong opened this issue Feb 5, 2016 · 3 comments
Labels
bug This issue/PR relates to a bug.

Comments

@christianmlong
Copy link

If you have a pre_gen_project.sh or a post_gen_project.sh file with no data in it, cookiecutter fails with an unhelpful traceback.

Traceback (most recent call last):
  File "/usr/local/bin/cookiecutter", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/cli.py", line 100, in main
    config_file=user_config
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/main.py", line 140, in cookiecutter
    output_dir=output_dir
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/generate.py", line 273, in generate_files
    _run_hook_from_repo_dir(repo_dir, 'pre_gen_project', project_dir, context)
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/generate.py", line 232, in _run_hook_from_repo_dir
    run_hook(hook_name, project_dir, context)
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/hooks.py", line 116, in run_hook
    run_script_with_context(script, project_dir, context)
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/hooks.py", line 101, in run_script_with_context
    run_script(temp.name, cwd)
  File "/usr/local/lib/python2.7/site-packages/cookiecutter/hooks.py", line 73, in run_script
    cwd=cwd
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 656, in __init__
    _cleanup()
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error
@hackebrot
Copy link
Member

Hi @christianmlong!

Thank you for submitting a ticket.

Would you mind sending a patch?

Cheers
Raphael

@hackebrot hackebrot added the bug This issue/PR relates to a bug. label Feb 6, 2016
@hackebrot
Copy link
Member

🔔

@jcarbaugh
Copy link
Contributor

I'm taking a look at this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants