Jython VsCode and pylint

Tags: #<Tag:0x00007f744e3ed158> #<Tag:0x00007f744e3ecff0> #<Tag:0x00007f744e3eced8>

Hi there,
Me again
All is well and the rule transfer going well
However I get these in VSCode:

I have followed this: https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/VS%20Code.html

And saw this:

To no avail

Any advice?

Unfortunately I’ve never seen these errors and now I’m not certain that I even have pylint properly configured. :frowning: When I add stuff that it should pick up like “import foo” I don’t get any problems.

Are you by any chance editing using the Remote SSH extension? I thought I had it set up properly all this time.

Nope, just following this: https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/VS%20Code.html

I’ll try a fresh vscode install tomorrow

Everything underlined that I can see is a Java package, or part of the default script environment. These things are only available when running in the Jython environment inside openHAB unfortunately, you will not be able to resolve them. There should be a note on the instructions saying that things from the Java/openHAB scope are not available.

Hi all,

Any ideas for improving the JSR223 experience in vscode are welcome.
We have already a (really old) corresponding issue in github which i revived last days.

We have talked about general improvements and things we could add, like snippets for jythong and javascript.
There is also the posibility to use items and things browser now, when having jsr223 files opened.
The sidebar will be available permanently from now on.
You can test this with the current beta extension.

So if there are additional things that would be useful and we can solve that within the extension we should add it to the list.

I don’t know much about how VSC extensions work, but this problem is caused by pylint (an external program run by VSC in the background) not having access to the default script context. I’m not sure the VSC extension would be able to help here, though I hope I’m wrong about it because it would be handy.

google pylint and jython - I found several posts but not an obvious answer.

Vincent, sorry I did not have time to reply sooner. What you are reporting looks normal to me. I use a .pylintrc file and I’ll put in a PR tommorow to add one to the repo. Until then, add one to the root of your workspace with this as the contents…



# Maximum number of parents for a class (see R0901).

There may be some other entries that we’d want to include, but these resolved all of the issues I had.

1 Like

@openhab-5iver is it wise to suggest the use of ignored like unused-variable and undefined-variable in the documentation? I feel like the latter at least is most helpful to beginners, but using it is how you would suppress the error coming up for something common like the items dict.

I have no detailled knowledge about this case, but that doesn’t mean that we can’t have a look at it.

My post was a bit of a general one, to make people aware of the fact that we want to support jsr223 more and everyone is invited to help with ideas, suggestions and concrete implementations.
And for getting a good base experienced jsr users are needed. :slight_smile: