Skip to content

[BUG] Prospector fails pylint error - 1.13.x #703

@robertalexa

Description

@robertalexa

Hi,

Upgrading from 1.12.1 to any of the 1.13.x versions ends with with a pylint error on Django.

Python version used - 3.13

Unfortunately I understand too little about the chain from propesctor to pylint and how astroid intervenes, so I won't even pretend to make an assumption on this one.

Happy to do further testing if required. Here is a traceback of the error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/logging/config.py", line 583, in configure
    formatters[name] = self.configure_formatter(
                       ~~~~~~~~~~~~~~~~~~~~~~~~^
                                        formatters[name])
                                        ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/logging/config.py", line 693, in configure_formatter
    result = self.configure_custom(config)
  File "/usr/local/lib/python3.13/logging/config.py", line 487, in configure_custom
    result = c(**kwargs)
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/django/utils/log.py", line 182, in __init__
    self.style = color_style()
                 ~~~~~~~~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/django/core/management/color.py", line 118, in color_style
    if not force_color and not supports_color():
                               ~~~~~~~~~~~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/django/core/management/color.py", line 54, in supports_color
    is_a_tty = hasattr(sys.stdout, "isatty") and sys.stdout.isatty()
                                                 ~~~~~~~~~~~~~~~~~^^
ValueError: I/O operation on uninitialized object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/prospector/run.py", line 87, in execute
    messages += tool.run(found_files)
                ~~~~~~~~^^^^^^^^^^^^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/prospector/tools/pylint/__init__.py", line 264, in run
    self._linter.check(self._args)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/pylint/lint/pylinter.py", line 699, in check
    with self._astroid_module_checker() as check_astroid_module:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/pylint/lint/pylinter.py", line 947, in _astroid_module_checker
    checker.open()
    ~~~~~~~~~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/pylint_django/checkers/foreign_key_strings.py", line 85, in open
    django.setup()
    ~~~~~~~~~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/django/utils/log.py", line 72, in configure_logging
    logging.config.dictConfig(DEFAULT_LOGGING)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/logging/config.py", line 935, in dictConfig
    dictConfigClass(config).configure()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/logging/config.py", line 586, in configure
    raise ValueError('Unable to configure '
                     'formatter %r' % name) from e
ValueError: Unable to configure formatter 'django.server'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/hav-sentry/.local/bin/prospector", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/prospector/run.py", line 200, in main
    prospector.execute()
    ~~~~~~~~~~~~~~~~~~^^
  File "/home/hav-sentry/.local/lib/python3.13/site-packages/prospector/run.py", line 105, in execute
    raise FatalProspectorException(f"Tool {toolname} failed to run.") from ex
prospector.exceptions.FatalProspectorException: Tool pylint failed to run.

PS: @Pierre-Sassoulas I know you have helped tremendously migrating to the new python version and you have helped work through the snags of this. Any chance you can assist with this?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions