victorlei / smop

Small Matlab to Python compiler
MIT License
1.08k stars 410 forks source link

Fail on trivial input - installation issue? #148

Closed nasamaher closed 5 years ago

nasamaher commented 5 years ago

Hi, I'm getting an error on a trivial file (that runs with Octave) I must have installed something wrong. I originally installed as user (python setup.py install --user) and later globally (sudo python setup.py install) .. after deleting ~/.local. (I'm not sure that was right).

Any clues are greatly appreciated!

Steve

Ubuntu 18.04, smop 0.41-beta

cat test.m

function test
disp('hey')
end

smop test.m

WARNING: Couldn't open 'parser.out'. [Errno 20] Not a directory: '/usr/local/lib/python2.7/dist-packages/smop-0.41b0-py2.7.egg/smop/parser.out'
WARNING: Token 'END_UNEXPECTED' defined, but not used
WARNING: Token 'CLASSDEF' defined, but not used
WARNING: There are 2 unused tokens
Generating LALR tables
WARNING: Couldn't create 'smop.parsetab'. [Errno 20] Not a directory: '/usr/local/lib/python2.7/dist-packages/smop-0.41b0-py2.7.egg/smop/parsetab.py'
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/smop/main.py", line 61, in main
    stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')
  File "build/bdist.linux-x86_64/egg/smop/parse.py", line 850, in parse
    buf, tracking=1, debug=options.debug_parser, lexer=new_lexer)
  File "/usr/local/lib/python2.7/dist-packages/ply-3.11-py2.7.egg/ply/yacc.py", line 331, in parse
    return self.parseopt(input, lexer, debug, tracking, tokenfunc)
  File "/usr/local/lib/python2.7/dist-packages/ply-3.11-py2.7.egg/ply/yacc.py", line 909, in parseopt
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/usr/local/lib/python2.7/dist-packages/ply-3.11-py2.7.egg/ply/yacc.py", line 192, in call_errorfunc
    r = errorfunc(token)
  File "build/bdist.linux-x86_64/egg/smop/parse.py", line 838, in p_error
    new_lexer)
  File "build/bdist.linux-x86_64/egg/smop/lexer.py", line 338, in raise_exception
    my_lexer.lexdata[startpos:endpos]))
  File "test.m", line 3
    disp('hey')
    ^
SyntaxError: Unexpected ";" (parser)
Errors: 1
nasamaher commented 5 years ago

BTW I get the same error when adding a ';' after the disp() line. The Errno 20 is suspicious and I also tried running with sudo in case it was a permission error.

nasamaher commented 5 years ago

Have tried fresh installs on two other Ubuntu 18.04 boxes and got the exact same error. I also tried uninstalling octave. Below where my installs.

Any help is appreciated.

Steve

sudo apt-get install python-numpy python-scipy python-matplotlib ipython python-pandas python-sympy python-nose
sudo apt install python-pip
sudo pip install 'networkx==2.2'
cd smop-master/
sudo python setup.py install
nasamaher commented 5 years ago

Sorry for the "journal" but FYI I have also tried pip uninstall/install smop (and networkx==2.2) and that changed the smop version from 0.41-beta to 0.41. Still no luck. I feel like I must be missing something obvious.

Steve

nasamaher commented 5 years ago

Self-closing and opening cleaner version (cleaner smop install and thus cleaner issue)