Open alexandermatthias opened 3 years ago
I am very late to the party, huh... but I had faced the same issue. The most awful solution I came up with is to comment out some lines in Jedi modules themselves.
In dependencies/jedi/_compatibility.py
comment out lines 395 and 396, which are:
def pickle_load(file):
try:
# if is_py3: # <-- line 395
# return pickle.load(file, encoding='bytes')
return pickle.load(file)
# Python on Windows don't throw EOF errors for pipes. So reraise them with
# the correct type, which is caught upwards.
except OSError:
if sys.platform == 'win32':
raise EOFError()
raise
In dependencies/jedi/api/environment.py
comment lines 99-101.
# py2 sends bytes via pickle apparently?!
# if self.version_info.major == 2: # <-- line 99
# self.executable = self.executable.decode()
# self.path = self.path.decode()
# Adjust pickle protocol according to host and client version.
self._subprocess._pickle_protocol = highest_pickle_protocol([
sys.version_info, self.version_info])
Before doing these changes, make sure that your .sublime-project
file uses Python 2.7 interpreter, which is defined in settings['python_interpreter']
section.
After that, autocompletion should start working as intended, but its speed is sorta sluggish. Better than nothing, still...
More 'updates' on the problem. With my own 'fix' the plugin works for a while, but some time after it may explode in very long traceback... and I have no idea how to fix this for real or at least mitigate.
UPD: or I have an idea! But I'm not sure if this change affects Python 3.x scenarios.
In dependencies/jedi/_compatibility.py
replace encoding 'bytes' on line 396 with 'latin-1':
def pickle_load(file):
try:
if is_py3:
return pickle.load(file, encoding='latin-1') # <-- line 396
return pickle.load(file)
# Python on Windows don't throw EOF errors for pipes. So reraise them with
# the correct type, which is caught upwards.
except OSError:
if sys.platform == 'win32':
raise EOFError()
raise
Speaking of dependencies/jedi/api/environment.py
:99-101, I had a rather interesting result. My project uses Python 2.7.7, but self.executable
and self.path
don't have to be additionaly .decode()
'd. They print normally as is.
Hi All,
I am still a beginner, so bear with me. My immediate problem is that am having trouble getting Jedi to autocomplete for python 2.7.16, but the ultimate goal is to set up Sublime Text to develop IronPython code that will ultimately be run in Rhino.
I have just done a clean install of Sublime Text 4 and Jedi v0.18.0, as well as a clean install of Python 2.7.16. Here is a complete print-out from the console that I receive when I try to test Jedi autocomplete:
Here is a screenshot of Sublime Text 4, so you can see what I see:![image](https://user-images.githubusercontent.com/44324576/125053752-c4264480-e0a5-11eb-8ebb-b97c1a555a0e.png)
And here is a link to the stubs that I am ultimately trying to use. It seems like I need to get Jedi working on standard python autocomplete before attempting to get the stubs to work though.... More info here