SlicerCustomAppTemplate icon indicating copy to clipboard operation
SlicerCustomAppTemplate copied to clipboard

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

Open sjh26 opened this issue 5 years ago • 1 comments

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

sjh26 avatar Mar 21 '20 21:03 sjh26

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

jcfr avatar Mar 23 '20 19:03 jcfr