Skip to content

codespell fails to run on linux with version 2.3.0 #3545

@boralyl

Description

@boralyl

I recently upgraded my pre-commit hook version from 2.2.6 -> 2.3.0 and get a ValueError when running:

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repo3sgkbuvg/py_env-python3.9/bin/codespell", line 5, in <module>
    from codespell_lib import _script_main
  File "/home/runner/.cache/pre-commit/repo3sgkbuvg/py_env-python3.9/lib/python3.9/site-packages/codespell_lib/__init__.py", line 1, in <module>
    from ._codespell import _script_main, main
  File "/home/runner/.cache/pre-commit/repo3sgkbuvg/py_env-python3.9/lib/python3.9/site-packages/codespell_lib/_codespell.py", line 28, in <module>
    from ctypes import wintypes
  File "/home/runner/.local/share/uv/python/cpython-3.9.0-linux-x86_64-gnu/lib/python3.9/ctypes/wintypes.py", line 20, in <module>
    class VARIANT_BOOL(ctypes._SimpleCData):
ValueError: _type_ 'v' not supported

This error looks reasonable as you can't import wintypes on linux:

Python 3.9.0 (default, Oct 20 2020, 07:41:32) 
[Clang 11.0.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import wintypes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/aaron/.local/share/uv/python/cpython-3.9.0-linux-x86_64-gnu/lib/python3.9/ctypes/wintypes.py", line 20, in <module>
    class VARIANT_BOOL(ctypes._SimpleCData):
ValueError: _type_ 'v' not supported

It looks like this was introduced when adding support for ANSI colors on windows: #3259

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions