Skip to content

spelling-private-dict-file should be looked up relative to pylintrc file instead of current folder #8972

Open
@jjmortensen

Description

@jjmortensen

Bug description

With this in my pylintrc (which is at the root of my git repository):

[SPELLING]
spelling-dict=en_US
spelling-private-dict-file=doc/words.txt

pylint will only find the words.txt file if I'm launching it from the folder where the pylintrc file is.

Configuration

No response

Command used

pylint code.py

Pylint output

Traceback (most recent call last):
  File "/home/jensj/.local/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/jensj/.local/lib/python3.10/site-packages/pylint/__init__.py", line 35, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/home/jensj/.local/lib/python3.10/site-packages/pylint/lint/run.py", line 207, in __init__
    linter.check(args)
  File "/home/jensj/.local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 693, in check
    with self._astroid_module_checker() as check_astroid_module:
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/jensj/.local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 990, in _astroid_module_checker
    checker.open()
  File "/home/jensj/.local/lib/python3.10/site-packages/pylint/checkers/spelling.py", line 317, in open
    self.spelling_dict = enchant.DictWithPWL(
  File "/home/jensj/.local/lib/python3.10/site-packages/enchant/__init__.py", line 784, in __init__
    f = open(pwl, "wt")
FileNotFoundError: [Errno 2] No such file or directory: 'doc/words.txt'

Expected behavior

It should find the words.txt file also when I'm in a subfolder of the folder where the pylintrc file is.

Pylint version

Latest from PyPI

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Labels

Bug 🪲Needs specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions