Skip to content

Commitizen installed not able to run command on windows system #1219

Closed
@taragurung

Description

@taragurung

Description

I am getting this error when runningcz commit

$ cz commit
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\cz.exe\__main__.py", line 7, in <module>
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\commitizen\cli.py", line 638, in main
    args.func(conf, arguments)()
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\commitizen\commands\commit.py", line 102, in __call__
    m = self.prompt_commit_questions()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\commitizen\commands\commit.py", line 55, in prompt_commit_questions
    answers = questionary.prompt(questions, style=cz.style)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\questionary\prompt.py", line 78, in prompt
    return unsafe_prompt(questions, answers, patch_stdout, true_color, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\questionary\prompt.py", line 221, in unsafe_prompt
    question = create_question_func(**_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\questionary\prompts\select.py", line 185, in select
    layout = common.create_inquirer_layout(ic, get_prompt_tokens, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\questionary\prompts\common.py", line 510, in create_inquirer_layout
    ps: PromptSession = PromptSession(
                        ^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\shortcuts\prompt.py", line 476, in __init__
    self.app = self._create_application(editing_mode, erase_when_done)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\shortcuts\prompt.py", line 727, in _create_application
    application: Application[_T] = Application(
                                   ^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\application\application.py", line 282, in __init__
    self.output = output or session.output
                            ^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\application\current.py", line 71, in output
    self._output = create_output()
                   ^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\output\defaults.py", line 85, in create_output
    return Win32Output(stdout, default_color_depth=color_depth_from_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\output\win32.py", line 114, in __init__
    info = self.get_win32_screen_buffer_info()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\APR28\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\prompt_toolkit\output\win32.py", line 218, in get_win32_screen_buffer_info
    raise NoConsoleScreenBufferError
prompt_toolkit.output.win32.NoConsoleScreenBufferError: Found xterm, while expecting a Windows console. Maybe try to run this program using "winpty" or run it in cmd.exe instead. Or otherwise, in case of Cygwin, use the Python executable that is compiled for Cygwin.

Steps to reproduce

  1. install commitizen with pip command in Windows 11 Pro
  2. added to environment path was getting warning during installation so
  3. setup a git repo and folder
  4. run cz commit

Current behavior

not able to run cz commit, getting error shown above

Desired behavior

cz commit running as expected

Screenshots

No response

Environment

  • commitizen version: 3.29.0
  • OS: Windows-11
  • python version: Python 3.12.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions