4

I'm currently working on a Jython project (using Jython 2.7.3) in PyCharm Community Edition (2023.2.3) and I'm having difficulty configuring Java libraries in the IDE. Although my code runs fine when executed (the Java imports are working as expected at runtime), PyCharm is underlining the Java import statements indicating that it cannot resolve them.

Here is what I see instead:

screenshot of linter errors on imports in editor window

Could someone guide me on how PyCharm Community Edition could recognizes the import statements?

4
  • Could this answer your question ? Commented Feb 5, 2024 at 14:28
  • I've read and reread it, used it and reused it. Unfortunately, it's too generic for my case. Commented Feb 7, 2024 at 8:20
  • See my answer below, there are no workarounds for linter bugs because the linter is compiled so when a release ships with a linter bug the only choice is waiting for a next release with a bug fix. It's not uncommon for PyCharm releases to have linter bugs, e.g. one example and another example sometimes these bugs can have regressions (the last had several over the years). Given these bugs are confusing (you never know if you're making a mistake in the import) it can be better to revert to an older version. Commented Feb 8, 2024 at 19:07
  • If the answer adequately addressed the problem please don't forget to manually award the bounty otherwise the reputation will be lost. Commented Feb 8, 2024 at 23:49

1 Answer 1

0

Currently there's a PyCharm bug where the linter will signal Jython imports with:

unresolved reference

See issues PY-52153 and also PY-52999. The issues have been triaged and confirmed by the JetBrains support team, so they're pending a fix but it's confirmed the bug happens with correctly configured projects through no fault of the user.

The only known workaround is using the earlier PyCharm 2021.1 as indicated in this comment and also this post as that was the last version unaffected by the bug.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.