Skip to content

AttributeError: 'ForeignKeyStringsChecker' object has no attribute 'config' #430

Open
@EfraimGENC

Description

@EfraimGENC

My Requirements:

Django==5.0.3
django-environ==0.11.2
psycopg2-binary==2.9.9
redis==5.0.3
djangorestframework==3.15.0
markdown==3.6.0
django-filter==24.1
celery==5.3.6
pylint==3.1.0
pylint-django==2.5.5
django-debug-toolbar==4.3.0

When I run this command:
pylint --load-plugins pylint_django --django-settings servis.settings.dev .

I am getting this error:

...
  File "/Users/<myusername>/Documents/projects/<myproject>/venv/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 946, in _astroid_module_checker
    checker.open()
  File "/Users/<myusername>/Documents/projects/<myproject>/venv/lib/python3.12/site-packages/pylint_django/checkers/foreign_key_strings.py", line 120, in open
    args=self.config.django_settings_module,
         ^^^^^^^^^^^
AttributeError: 'ForeignKeyStringsChecker' object has no attribute 'config'

I couldn't find any solution via googling with AttributeError: 'ForeignKeyStringsChecker' object has no attribute 'config'

Is anyone can help me? Do you support Django 5.0 ?

Activity

shtalinberg

shtalinberg commented on May 8, 2024

@shtalinberg

I have the same error with Django==4.2.13 and python3.10

shtalinberg

shtalinberg commented on May 10, 2024

@shtalinberg

@EfraimGENC I resolved by set this setting for my project
init-hook='import os, sys; sys.path.append("src"); sys.path.append("src/apps");'

added a commit that references this issue on Jul 20, 2024

[#430] Fixing reference to linter config object (which moved between …

carlio

carlio commented on Jul 20, 2024

@carlio
Member

@EfraimGENC Can you try this now with the latest master branch? I just found a bug elsewhere which I think will fix this one too.

Regarding 5.0, that is supported in the latest master branch, I'm working towards making a release to PyPI with that support.

ediordna

ediordna commented on Sep 4, 2024

@ediordna

Is it possible to release this to a new version to make it downloadable via pip etc?

hepcat72

hepcat72 commented on Mar 24, 2025

@hepcat72

For others ending up here... the AttributeError could be (depending on your version) due to a missing __init__.py file. I just updated to the latest and I don't get the exception any longer, but I do get an error (unless I add that file back):

$ pylint --rcfile .pylintrc --load-plugins pylint_django --django-settings-module TraceBase.settings -d E1101 DataRepo/widgets/search.py
************* Module Command line or configuration file
Command line or configuration file:1:0: F5110: Provided Django settings TraceBase.settings could not be loaded (django-settings-module-not-found)

My upgrades:

  • pylint-django 0.8.2 -> 2.6.1
  • pylint 3.1.0 -> 3.3.6

Python 3.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @carlio@hepcat72@shtalinberg@ediordna@EfraimGENC

        Issue actions

          AttributeError: 'ForeignKeyStringsChecker' object has no attribute 'config' · Issue #430 · pylint-dev/pylint-django