erlport icon indicating copy to clipboard operation
erlport copied to clipboard

importing erlport in Python3 yields syntax error

Open vtsatskin opened this issue 7 years ago • 4 comments

> pip3 install erlport
Collecting erlport
Installing collected packages: erlport
Successfully installed erlport-0.6
> python3
Python 3.5.2 (default, Nov 25 2016, 16:29:04) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import erlport
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/erlport/__init__.py", line 33, in <module>
    from erlport.erlproto import Port, Protocol
  File "/usr/local/lib/python3.5/site-packages/erlport/erlproto.py", line 107
    except IOError, why:
                  ^
SyntaxError: invalid syntax

I noticed the current version of erlport is 0.9.8 but the one listed on pypi is 0.6. Is this correct? If not, can the python package on pypi be updated?

Tangentially, how does one go about installing the erlport python library from the source code?

vtsatskin avatar May 17 '17 18:05 vtsatskin

In case this helps, I saw a closed issue that recommends removing erlport from pip, and relying on erlport loading the python module at runtime (https://github.com/hdima/erlport/issues/32).

In my case, following that advice removed the syntax error you referenced, but caused a different error "no module named erlport.cli" instead. The fix was to copy the erlport folder (which includes cli.py) from \erlport-0.9.8\priv\python3\ to \Anaconda3\Lib\site-packages.

puruzio avatar Jul 05 '17 17:07 puruzio

@puruzio Apparently cli.py has been removed from https://github.com/hdima/erlport/tree/master/priv/python3/erlport so I can't see how I can get around this issue now.

ghost avatar Oct 11 '17 14:10 ghost

You have to first copy the contents of python2 and after that copy the contents of python3 on top. Not all files have an explicit Python 3 version.

filmor avatar Oct 11 '17 14:10 filmor

@filmor Thanks a lot it works!

It seems that this should be part of the install process, shouldn't it?

ghost avatar Oct 12 '17 13:10 ghost