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

Can't generate project whose project/app name starts with a lowercase letter #19

Open
sjh26 opened this issue Mar 21, 2020 · 1 comment

Comments

@sjh26
Copy link
Contributor

sjh26 commented Mar 21, 2020

When trying to use a lower case starting letter, cookiecutter appears to store it internally as uppercase

$ cookiecutter gh:KitwareMedical/SlicerCustomAppTemplate
You've downloaded C:\Users\sam.horvath\.cookiecutters\SlicerCustomAppTemplate be                                                                                          fore. Is it okay to delete and re-download it? [yes]: yes
project_name [SlicerCustomAppTemplate]: aevaSlicer
github_organization [Kitware]:
github_project [AevaSlicer]: aevaSlicer
org_domain [kitware.com]:
org_name [Kitware, Inc.]:
app_name [AevaSlicer]: aevaSlicer
app_version_major [0]:
app_version_minor [1]:
app_version_patch [0]:
app_description_summary [Customized version of Slicer]:
Traceback (most recent call last):
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\runpy.py                                                                                          ", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\runpy.py                                                                                          ", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\sam.horvath\AppData\Local\Programs\Python\Python37\Scripts\cook                                                                                          iecutter.exe\__main__.py", line 9, in <module>
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\cookiecutter\cli.py", line 121, in main
    password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\cookiecutter\main.py", line 94, in cookiecutter
    output_dir=output_dir
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\cookiecutter\generate.py", line 364, in generate_files
    generate_file(project_dir, infile, context, env)
  File "c:\users\sam.horvath\appdata\local\programs\python\python37\lib\site-pac                                                                                          kages\cookiecutter\generate.py", line 176, in generate_file
    with io.open(outfile, 'w', encoding='utf-8') as fh:
OSError: [Errno 22] Invalid argument: 'D:\\Cookiecutter\\AevaSlicer\x1b[D\x1b[D\                                                                                          x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\x1b[a\\CMakeLists.txt'

Note how the defaults for later prompts are uppercase

@jcfr
Copy link
Collaborator

jcfr commented Mar 23, 2020

I wasn't able to reproduce this on Linux or Windows. For example, here is the output on Windows:

(test-cookiecutter) D:\T\test-cc>cookiecutter gh:KitwareMedical/SlicerCustomAppTemplate
project_name [SlicerCustomAppTemplate]: abcdeSlicer
github_organization [Kitware]:
github_project [abcdeSlicer]: abcdeSlicer
org_domain [kitware.com]:
org_name [Kitware, Inc.]:
app_name [abcdeSlicer]: abcdeSlicer
app_version_major [0]:
app_version_minor [1]:
app_version_patch [0]:
app_description_summary [Customized version of Slicer]:

(test-cookiecutter) D:\T\test-cc>python --version
Python 3.7.2

(test-cookiecutter) D:\T\test-cc>

The end of the error message may provide more details, it is suspicious to see \x1b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants