keyboardlayouteditor icon indicating copy to clipboard operation
keyboardlayouteditor copied to clipboard

Unable to build on Mint 19.3: antlr_python_runtime - 'invalid syntax'

Open LinuxOnTheDesktop opened this issue 5 years ago • 4 comments

$ sudo -H pip install http://www.antlr3.org/download/Python/antlr_python_runtime-3.1.2.tar.gz
Collecting http://www.antlr3.org/download/Python/antlr_python_runtime-3.1.2.tar.gz
  Downloading http://www.antlr3.org/download/Python/antlr_python_runtime-3.1.2.tar.gz (67kB)
     |████████████████████████████████| 71kB 2.0MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-ke4jo6eg/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-ke4jo6eg/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-ke4jo6eg/pip-egg-info
         cwd: /tmp/pip-req-build-ke4jo6eg/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-ke4jo6eg/setup.py", line 49
        except OSError, exc:
                      ^
    SyntaxError: invalid syntax
    ----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I found a package in my repos called 'antlr4' so I installed that - but the java command in your instructions (even when that command was modified accordingly) - threw an error:

~/git/kbl/keyboardlayouteditor $ java -classpath antlr-4.jar org.antlr.Tool *.g
Error: Could not find or load main class org.antlr.Tool

Cf. #2.

LinuxOnTheDesktop avatar Jan 06 '20 13:01 LinuxOnTheDesktop

Your pip is finding its way to a Python 3 pip, and it's erroring out on Python 2 syntax that it doesn't understand. Try pip2 (which should be available if you've done sudo apt-get install python-pip)

rakslice avatar Jan 09 '20 21:01 rakslice

Since the instructions already have Debianisms perhaps they should say pip2

rakslice avatar Jan 09 '20 21:01 rakslice

Using pip2 instead of pip worked for me. Please update the documentation!

qole avatar Feb 13 '20 05:02 qole

Use command : java -classpath antlr-4.jar org.antlr.Tool Keycodes.g KeycodesWalker.g XKBGrammar.g XKBGrammarWalker.g

and launch program : python2 ./KeyboardLayoutEditor

PS: System manjaro

Dev-Crea avatar Jun 01 '20 09:06 Dev-Crea