Skip to content

Lately getting TypeError: stat: path should be string, bytes #40

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

Closed
noorul opened this issue Jun 10, 2021 · 4 comments
Closed

Lately getting TypeError: stat: path should be string, bytes #40

noorul opened this issue Jun 10, 2021 · 4 comments

Comments

@noorul
Copy link

noorul commented Jun 10, 2021

The following is the message displayed
LSP :: Error from the Language Server: TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType (Invalid Parameters) [5 times]

2021-06-10 09:48:48,203 UTC - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 935
Traceback (most recent call last):
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request
    handler_result = handler(params)
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp/python_lsp.py", line 334, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp/python_lsp.py", line 250, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp/python_lsp.py", line 155, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/manager.py", line 337, in traced_hookexec
    return outcome.get_result()
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/callers.py", line 52, in from_call
    result = func()
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/manager.py", line 335, in <lambda>
    outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "=========================================================================================/ENV/lib/python3.7/site-packages/pylsp/plugins/symbols.py", line 42, in pylsp_document_symbols
    docismodule = os.path.samefile(document.path, d.module_path)
  File "/usr/local/opt/[email protected]/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 101, in samefile
    s2 = os.stat(f2)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

@douglasdavis
Copy link
Contributor

douglasdavis commented Jun 10, 2021

This was fixed by #31. You can pip install git+https://github.com/python-lsp/python-lsp-server@develop to get a version with the fix until a new release is cut.

@noorul
Copy link
Author

noorul commented Jun 10, 2021

@douglasdavis Is there a release ETA?

@noorul
Copy link
Author

noorul commented Jun 10, 2021

This is working with develop branch.

@noorul noorul closed this as completed Jun 10, 2021
@douglasdavis
Copy link
Contributor

@douglasdavis Is there a release ETA?

not that I know of :)

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

2 participants