Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: strange bug in code-server #16

Open
spali opened this issue Nov 5, 2024 · 0 comments
Open

BUG: strange bug in code-server #16

spali opened this issue Nov 5, 2024 · 0 comments

Comments

@spali
Copy link

spali commented Nov 5, 2024

It doesn't seem to work well in code-server addon of HA.
It works by adding . to the imports in the last two lines:

# noinspection PyBroadException
try:
    """works in pyscript environment only"""
    # noinspection PyUnresolvedReferences,PyUnboundLocalVariable
    task.current_task()
except:
    from .pyscript_builtins import *
    from .pyscript_generated import *

Not a python expert... but I thought anyway this would be the right way to import relative code within the same directory ?
Not sure if other IDE's would have problems with the dots.

Even with this fix I still seem to have a small strange ambiguous "bug":
image
It claims to not find the member app_config but at the same time shows the definition of it 😕
It seems to be only pylint that has problems, not intelli-sense.
Regarding the output of the pylint runs, it seems to include the modules directory as it lists it in the output as extrapaths, which are defined in settings.json:

...
  "python.autoComplete.extraPaths": ["pyscript/modules"],
  "python.analysis.extraPaths": ["pyscript/modules"],
...
Full uutput of the pylint console in the code server
2024-11-05 15:06:21.686 [info] Server run command: /bin/python3 /data/vscode/extensions/ms-python.pylint-2024.0.0-universal/bundled/tool/lsp_server.py
2024-11-05 15:06:21.686 [info] Server: Start requested.
2024-11-05 15:06:22.151 [info] CWD Server: /config
2024-11-05 15:06:22.151 [info] Settings used to run Server:
[
    {
        "enabled": true,
        "cwd": "/config",
        "workspace": "file:///config",
        "args": [],
        "severity": {
            "convention": "Information",
            "error": "Error",
            "fatal": "Error",
            "refactor": "Hint",
            "warning": "Warning",
            "info": "Information"
        },
        "path": [],
        "ignorePatterns": [],
        "interpreter": [
            "/bin/python3"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off",
        "extraPaths": [
            "pyscript/modules"
        ]
    }
]

2024-11-05 15:06:22.151 [info] Global settings:
{
    "cwd": "${workspaceFolder}",
    "enabled": true,
    "workspace": "/config",
    "args": [],
    "severity": {
        "convention": "Information",
        "error": "Error",
        "fatal": "Error",
        "refactor": "Hint",
        "warning": "Warning",
        "info": "Information"
    },
    "path": [],
    "ignorePatterns": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off",
    "extraPaths": []
}

2024-11-05 15:06:22.151 [info] sys.path used to run Server:
   pyscript/modules
   /config
   /data/vscode/extensions/ms-python.pylint-2024.0.0-universal/bundled/libs
   /data/vscode/extensions/ms-python.pylint-2024.0.0-universal/bundled/tool
   /usr/lib/python311.zip
   /usr/lib/python3.11
   /usr/lib/python3.11/lib-dynload
   /usr/local/lib/python3.11/dist-packages
   /usr/lib/python3/dist-packages
2024-11-05 15:06:22.154 [info] /bin/python3 -m pylint --version
2024-11-05 15:06:22.154 [info] CWD Linter: /config
2024-11-05 15:06:22.402 [info] 
pylint 3.2.7
astroid 3.2.4
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]


2024-11-05 15:06:22.402 [info] Version info for linter running for /config:
pylint 3.2.7
astroid 3.2.4
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]

2024-11-05 15:06:22.402 [info] SUPPORTED pylint>=2.12.2
FOUND pylint==3.2.7

2024-11-05 15:06:22.408 [info] [Trace - 3:06:22 PM] Received notification 'window/logMessage'.
2024-11-05 15:06:22.408 [info] /bin/python3 -m pylint --reports=n --output-format=json --clear-cache-post-run=y --from-stdin /config/pyscript/apps/mail/__init__.py
2024-11-05 15:06:22.408 [info] [Trace - 3:06:22 PM] Received notification 'window/logMessage'.
2024-11-05 15:06:22.408 [info] CWD Linter: /config
2024-11-05 15:06:23.155 [info] [Trace - 3:06:23 PM] Received notification 'window/logMessage'.
2024-11-05 15:06:23.155 [info] file:///config/pyscript/apps/mail/__init__.py :
[
    {
        "type": "error",
        "module": "mail",
        "obj": "mail",
        "line": 41,
        "column": 13,
        "endLine": 41,
        "endColumn": 32,
        "path": "pyscript/apps/mail/__init__.py",
        "symbol": "no-member",
        "message": "Class 'pyscript' has no 'app_config' member",
        "message-id": "E1101"
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant