Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

unresolved import 'json' #557

Closed
hujianxin opened this issue Jan 28, 2019 · 5 comments
Closed

unresolved import 'json' #557

hujianxin opened this issue Jan 28, 2019 · 5 comments

Comments

@hujianxin
Copy link

Hi,

I use mspls in sublime-text-3, and config like blew:

		"mspyls":
		{
			"command":
			[
				"dotnet",
				"exec",
				"~/dotfiles/python-language-server/output/bin/Release/Microsoft.Python.LanguageServer.dll"
			],
			"enabled": true,
			"initializationOptions":
			{
				"interpreter":
				{
					"properties":
					{
						"InterpreterPath": "~/.pyenv/shims/python",
						"UseDefaultDatabase": true,
						"Version": "3.7"
					}
				}
			},
			"languageId": "python",
			"scopes":
			[
				"source.python"
			],
			"syntaxes":
			[
				"Packages/Python/Python.sublime-syntax"
			]
		}

When I set InterpreterPath to a value contains ~ like "~/.pyenv/shims/python", LSP will always complain messages like unresolved import os

Is it becase mslsp does not support ~ path?

Thanks

@jakebailey
Copy link
Member

~ is expanded by the shell before being passed to another program. You should try an absolute path.

@hujianxin
Copy link
Author

@jakebailey Thanks for your explanation。

In some cases,configuration will be shared between some computers, an absolute path may cause inconvenience。Is there some method to solve this? Thanks

@hujianxin
Copy link
Author

Maybe environment variables?

@jakebailey
Copy link
Member

This option is something we've defined, so theoretically we could expand ~. This message is typically generated by the editor (so it can switch between interpreters, send user settings as they change, etc), so we hadn't considered it.

One thing you could try for now is to have the python executable you want in your PATH, then specify "python" as the interpreter. You may even be able to start the editor with pipenv shell.

@hujianxin
Copy link
Author

@jakebailey I understand your meaning, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants