compatible with python3
slashmili opened this issue · 6 comments
slashmili commented
erl_terms.py
is not compatible with python3
python3 erl_terms.py
...
File "erl_terms.py", line 198, in __main__.encode
Failed example:
encode([])
Exception raised:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 1330, in __run
compileflags, 1), test.globs)
File "<doctest __main__.encode[1]>", line 1, in <module>
encode([])
File "erl_terms.py", line 201, in encode
return FORMAT_VERSION + __encoder_func(struct)(struct)
TypeError: must be str, not bytes
...
slashmili commented
if someone has python3 as default for the moment make this change locally
diff --git a/elixir_sense_client b/elixir_sense_client
index 3a9d62c..4c622fd 100755
--- a/elixir_sense_client
+++ b/elixir_sense_client
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from __future__ import print_function
import os, sys, getopt
from elixir_sense import ElixirSenseClient
glittershark commented
another python3 error:
Traceback (most recent call last):
File "/home/griffin/.vim/bundle/alchemist.vim/elixir_sense_client", line 81, in <module>
main(sys.argv[1:])
File "/home/griffin/.vim/bundle/alchemist.vim/elixir_sense_client", line 71, in main
response = sense.process_command(request, source, line ,column)
File "/home/griffin/.dotfiles/.vim/bundle/alchemist.vim/elixir_sense.py", line 52, in process_command
req_erl_struct = erl_terms.encode(py_struct)
File "/home/griffin/.dotfiles/.vim/bundle/alchemist.vim/erl_terms.py", line 201, in encode
return FORMAT_VERSION + __encoder_func(struct)(struct)
File "/home/griffin/.dotfiles/.vim/bundle/alchemist.vim/erl_terms.py", line 229, in __encode_map
for k,v in obj.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
DarthIwan commented
@glittershark I have exact same error
bees commented
As a proof of concept: here's a rough pass at a python3 port. Doctests are all passing (tested with 3.6) and basic completion works - I haven't gotten a chance to test it beyond that. @slashmili if you're interested, I can continue working on this until its in a mergable state (i.e. not breaking python2 backwards compatibility, tests not sensitive to dictionary key ordering, etc).
slashmili commented
slashmili commented
@DarthIwan / @glittershark please fetch the latest and it should work without any patch