Skip to content

init-hook not working #605

@andresespinosapc

Description

@andresespinosapc

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): 3.10.13
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): poetry
  • Operating system (and version): MacOS 15.4
  • Version of tool extension you are using: 2025.2.0

Behaviour

Expected Behavior

To add the init-hook in .pylintrc and at least it runs.

Actual Behavior

I add the init-hook option in .pylintrc and it throws an error.

Reproduction Steps:

Set this in .pylintrc:

[MAIN]
init-hook='import pylint; print("pylint version: ", pylint.__version__)'

Logs:

Click here for detailed logs 2025-04-04 22:06:56.943 [info] [Trace - 10:06:56 PM] Received notification 'window/logMessage'. 2025-04-04 22:06:56.943 [info] [Error - 10:06:56 PM] Linting failed with error: Traceback (most recent call last): File "/Users/andres/.cursor/extensions/ms-python.pylint-2025.2.0/bundled/tool/lsp_server.py", line 150, in _linting_helper return _parse_output(result.stdout, severity=settings["severity"]) File "/Users/andres/.cursor/extensions/ms-python.pylint-2025.2.0/bundled/tool/lsp_server.py", line 192, in _parse_output messages: List[Dict[str, Any]] = json.loads(content) File "/Users/andres/.pyenv/versions/3.10.13/lib/python3.10/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/Users/andres/.pyenv/versions/3.10.13/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/andres/.pyenv/versions/3.10.13/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2025-04-04 22:06:56.946 [info] [Trace - 10:06:56 PM] Received notification 'textDocument/publishDiagnostics'.

Outcome When Attempting Debugging Steps:

Did running it from the command line work? Short answer, practically yes.

  • I tried to run this on the command line and got stuck: /Users/andres/workspace/cactus-ins-dj/.venv/bin/python /Users/andres/.cursor/extensions/ms-python.pylint-2025.2.0/bundled/tool/lsp_server.py
  • Also tried this and also got stuck: /Users/andres/workspace/cactus-ins-dj/.venv/bin/python -m pylint --reports=n --output-format=json --clear-cache-post-run=y --from-stdin /Users/andres/workspace/cactus-ins-dj/insurance/commands/policies/create_policy.py
  • Finally I simplified the last command to this and it worked: /Users/andres/workspace/cactus-ins-dj/.venv/bin/python -m pylint /Users/andres/workspace/cactus-ins-dj/insurance/commands/policies/create_policy.py

Extra Details

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions