quadrismegistus / prosodic

Prosodic: a metrical-phonological parser, written in Python. For English and Finnish, with flexible language support.
http://quadrismegistus.github.io/prosodic/
GNU General Public License v3.0
277 stars 43 forks source link

SyntaxError: invalid syntax #21

Closed LC740 closed 4 years ago

LC740 commented 4 years ago

Hi, I've just installed prosodic on a lubuntu with python3 (but I tried also with python 2.7) and I renamed config_default.py to config.py But every time I run "prosodic", I get this:

_File "/usr/local/bin/prosodic", line 5 cmd = f'python {path_to_prosodicpy} {argstr}' ^ SyntaxError: invalid syntax

Is there anything I can do to fix it? Note: the ^ is under the ' at the end of {argstr}'

quadrismegistus commented 4 years ago

I think that f' x... {var} x' string functionality was added in python 3.6. It's not really needed in that file though. I just edited it in the git repo. Can you try reinstalling? If you used pip to install, you can run:

pip install git+https://github.com/quadrismegistus/prosodic

Update: fixed again @ 14:48 GMT

LC740 commented 4 years ago

I uninstalled and reinstsalled prosodic (I used pip both times). This is the result:

Traceback (most recent call last): File "/usr/local/bin/prosodic", line 5, in import prosodic File "/usr/local/lib/python2.7/dist-packages/prosodic/init.py", line 2, in from .prosodic import * File "/usr/local/lib/python2.7/dist-packages/prosodic/prosodic.py", line 136 cmd='{dir_get_deps} "{dir_nlp_data}"' ^ SyntaxError: invalid syntax

quadrismegistus commented 4 years ago

I see, it looks like prosodic needs 3.6+ now, since those f"" string declarations are more pervasive. Could you try upgrading your python to 3.6+, and making sure your 'python' executable points to it? I recommend miniconda for python version management, fwiw.

LC740 commented 4 years ago

I upgraded python to 3.6.9 and linked python to its executable. I got another error:

Traceback (most recent call last): File "/usr/local/bin/prosodic", line 5, in [module] import prosodic ModuleNotFoundError: No module named 'prosodic'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/prosodic", line 13, in [module] import prosodic ModuleNotFoundError: No module named 'prosodic'

quadrismegistus commented 4 years ago

Hm, is your pip pointing to a different python than your python?

which python3
which python
which pip

?

Maybe try:

pip uninstall prosodic
python3 -m pip install git+https://github.com/quadrismegistus/prosodic

?

Otherwise, it's a bug and I'll look into it.

LC740 commented 4 years ago

"python3 -m pip install git+https://github.com/quadrismegistus/prosodic" fixed the problem. Thanks!

quadrismegistus commented 4 years ago

Great! Let me know if you have any other Qs. And keep in mind the web interface @ https://prosodic.stanford.edu for quick spot checking of lines or short texts. [Edit: the server seems to be down at the moment but should be back up soon.]