Closed xiaomoy closed 1 month ago
@xiaomoy - hi, I test it on python=3.13 but works fine on my side. Could you check whether lsp_jsonrpc.py
on c:\Users\1\.vscode\extensions\eeyore.yapf-2024.9.126091437\bundled\tool
floder? You can reinstall this extension if lsp_jsonrpc.py
not exists.
@xiaomoy - hi, I test it on python=3.13 but works fine on my side. Could you check whether
lsp_jsonrpc.py
onc:\Users\1\.vscode\extensions\eeyore.yapf-2024.9.126091437\bundled\tool
floder? You can reinstall this extension iflsp_jsonrpc.py
not exists.
The file lsp_jsonrpc.py
does exist, and I have attempted to reinstall the extension, but the error still persists.
@xiaomoy - Could you run
import sys
print(sys.path)
in a .py
file anywhere, like d:\Portables\python-3.13.0-embed-amd64\python.exe c:\Users\1\Desktop\python13_path.py
, to check whether c:\Users\1\Desktop
in the sys.path
. I think this's the python interpreter issue, the embed
suffix may not a suitable interpreter that automatic add the running directory to sys.path. Could u use another python interpreter or use the setting yapf.interpreter
to choice another interpreter different from your current project needed.
@xiaomoy - Could you run
import sys print(sys.path)
in a
.py
file anywhere, liked:\Portables\python-3.13.0-embed-amd64\python.exe c:\Users\1\Desktop\python13_path.py
, to check whetherc:\Users\1\Desktop
in thesys.path
. I think this's the python interpreter issue, theembed
suffix may not a suitable interpreter that automatic add the running directory to sys.path. Could u use another python interpreter or use the settingyapf.interpreter
to choice another interpreter different from your current project needed.
I ran this code, and it produced the following output.
['D:\\Portables\\python-3.13.0-embed-amd64\\python313.zip', 'D:\\Portables\\python-3.13.0-embed-amd64', 'D:\\Portables\\python-3.13.0-embed-amd64\\Lib\\site-packages']
I will try the method you mentioned. So, does that mean the embedded cannot be used directly?
@xiaomoy - the directory of the python entrance will insert to the head of sys.path
. It seems like the python-3.13.0-embed-amd64
will not complete this process automatically. You can add a code snipet in the lsp_server
, like
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
Or could you tell me roughly what kind of scenario would require using that interpreter? So I can consider whether it's a general case and then add that code on the extension side.
@xiaomoy - the directory of the python entrance will insert to the head of
sys.path
. It seems like thepython-3.13.0-embed-amd64
will not complete this process automatically. You can add a code snipet in thelsp_server
, likeimport sys import os sys.path.insert(0, os.path.dirname(__file__))
Or could you tell me roughly what kind of scenario would require using that interpreter? So I can consider whether it's a general case and then add that code on the extension side.
Thanks for your help, I have resolved the issue. I ended up installing Python using the installer instead of using the embedded version.