robotframework-lsp icon indicating copy to clipboard operation
robotframework-lsp copied to clipboard

libspec_manager crashes on FileNotFoundError

Open Ga22be opened this issue 1 year ago • 0 comments

Describe the bug When opening a robot file in VSCode a the robot framework LS crashes with the following error:

server-api: 2023-09-28 11:42:58 UTC pid: 90156 - ThreadPoolExecutor-0_0 - EXCEPTION - robotframework_ls.impl.libspec_manager
Unable to load source for file: /home/gsjoberg/.local/lib/python3.8/site-packages/PyYAML-5.1-py3.8-linux-x86_64.egg/yaml/__init__.py

Traceback (most recent call last):
  File "/home/gsjoberg/.vscode/extensions/robocorp.robotframework-lsp-1.11.0/src/robotframework_ls/impl/libspec_manager.py", line 139, in _create_updated_source_to_mtime
    mtime = os.path.getmtime(source)
  File "/usr/lib/python3.8/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/home/gsjoberg/.local/lib/python3.8/site-packages/PyYAML-5.1-py3.8-linux-x86_64.egg/yaml/__init__.py'

I have verified that /home/gsjoberg/.local/lib/python3.8/site-packages/yaml/__init__.py exists. I'm wondering why libspec_manager tries to access the package "within" an egg. It feels like some path logic is broken somewhere.

To Reproduce Steps to reproduce the behavior:

  1. Open file which import Library yaml
  2. Robot framework LS prints:
server-api: 2023-09-28 11:42:58 UTC pid: 90156 - ThreadPoolExecutor-0_0 - EXCEPTION - robotframework_ls.impl.libspec_manager
Unable to load source for file: /home/gsjoberg/.local/lib/python3.8/site-packages/PyYAML-5.1-py3.8-linux-x86_64.egg/yaml/__init__.py

Traceback (most recent call last):
  File "/home/gsjoberg/.vscode/extensions/robocorp.robotframework-lsp-1.11.0/src/robotframework_ls/impl/libspec_manager.py", line 139, in _create_updated_source_to_mtime
    mtime = os.path.getmtime(source)
  File "/usr/lib/python3.8/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/home/gsjoberg/.local/lib/python3.8/site-packages/PyYAML-5.1-py3.8-linux-x86_64.egg/yaml/__init__.py'

Expected behavior libspec_manager.py queries correct paths for packages

Versions:

  • OS: Ubuntu 20.04.6 LTS
  • Robot Framework Version: 4.1
  • Robot Framework Language Server Version: 1.11.0
  • Client Version: VSCode 1.82.2

Logs robotframework_ls.log.lint.server-api.126051.api.log

Ga22be avatar Sep 28 '23 11:09 Ga22be