markgw / jazzparser

A parser for jazz chord sequences to infer harmonic structure
Other
5 stars 1 forks source link

Error running ./jazzparser #1

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

I'm downloaded the parser and when I try ./jazzparser in the bin directory I get this error :

can't open file '../src/jazzparser/parse.py': [Errno 2] No such file or directory

I have python 3.5 (embedded in anaconda3) installed. Might this be the problem?

Thanks.

ghost commented 7 years ago

I changed the script inside jazzparser into this :

#!/bin/bash
# Runs the Jazz Parser, passing it all command-line args
. `dirname $0`/setpath
cd $here

## python2 ../src/jazzparser/parse.py $*
python2 /Users/cnytync/Programming/phd/jazzparser/src/jazzparser/parse.py $*

Now I'm getting this error :

readlink: illegal option -- m
usage: readlink [-n] [file ...]
Traceback (most recent call last):
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/parse.py", line 938, in <module>
    sys.exit(main())
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/parse.py", line 196, in main
    grammar = get_grammar(options.grammar)
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/grammar.py", line 1014, in get_grammar
    _loaded_grammars[name] = Grammar(name)
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/grammar.py", line 204, in __init__
    formalism = get_formalism(formalism_name)
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/formalisms/loader.py", line 45, in get_formalism
    return load_class(path)
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/utils/base.py", line 101, in load_class
    module = __import__(module_name, globals(), locals(), [model_name])
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/formalisms/music_halfspan/__init__.py", line 34, in <module>
    from . import syntax, semantics, rules, domxml, evaluation, pcfg, song tools
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/formalisms/music_halfspan/pcfg.py", line 37, in <module>
    from jazzparser.parsers.pcfg.model import PcfgModel, ModelError, \
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/parsers/pcfg/__init__.py", line 2, in <module>
    from .parser import PcfgParser as Parser
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/parsers/pcfg/parser.py", line 42, in <module>
    from jazzparser.utils.nltk.probability import logprob
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/utils/nltk/__init__.py", line 47, in <module>
    from .storage import FreqDistStorer, ConditionalProbDistStorer, MLEProbDistStorer, \
  File "/Users/cnytync/Programming/phd/jazzparser/src/jazzparser/utils/nltk/storage.py", line 33, in <module>
    from nltk.probability import MLEProbDist, FreqDist, ConditionalFreqDist, \
ImportError: cannot import name GoodTuringProbDist
markgw commented 7 years ago

You're right to use Python 2, rather than 3 - it won't work with 3.

The main problem, though, is that you need to set the paths that are set in the setpath script, but I suspect that when I wrote it I was using an older version of readlink, and that the options have changed.

In more recent code, I've used the following recipe, so I reckon that's likely to work better. Try replacing line 3 of setpath with:

"$(cd "$( dirname $( readlink -f "${BASH_SOURCE[0]}" ))" && pwd )"