Error running the pyAudioAnalysis sample program - python

I installed pyAudioAnalysis on python2.7 using pycharm (linux). Trying to run audioBasicIO.py gives the following error. I have installed eyeD3 but it does not work.
/usr/bin/python2.7 /usr/local/lib/python2.7/dist-packages/pyAudioAnalysis/audioBasicIO.py
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pyAudioAnalysis/audioBasicIO.py", line 6, in <module>
import eyed3
File "/home/.local/lib/python2.7/site-packages/eyed3/__init__.py", line 31, in <module>
from .utils.log import log # noqa: E402
File "/home/.local/lib/python2.7/site-packages/eyed3/utils/__init__.py", line 361
msg = f"invalid level choice: {level} (choose from {parser.log_levels})"
^
SyntaxError: invalid syntax
Is my installation incorrect? This is the first time I use this library, does anyone have any suggestions.

f-strings aren't supported for python 2.7. You need python 3.6 or above to use them. Here is a good workaround, in which you can use f-strings in below python 3.6.

Related

Error in importing "asammdf" in Python 3.5

I am trying to import asammdf to read MDF files but when i excute my script, there is an error from first line " import asammdf"
error is as follows :
Traceback (most recent call last):
File "<pyshell#2>", line 1, in
import asammdf
File "C:\Python\Python35-32\lib\site-packages\asammdf_init_.py", line 15, in
from .blocks.mdf_v2 import MDF2
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v2.py", line 4, in
from .mdf_v3 import MDF3
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v3.py", line 455
types.append(("", f"V{gap}"))
^
SyntaxError: invalid syntax
The library is using f-strings (see PEP 498), which were implemented in Python 3.6:
f"V{gap}"
But you are running this in Python 3.5:
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v3.py", line 455
You should install a newer version of Python. Python 3.5 is not supported any more (it is at end of life - see status of python branches).
Both github repo and the pypi page state that for version 5.x.y of asammdf the minimum python version is 3.6
You probably just copied the package manually to the site-packages folder

Error while attempting to import openai's universe

While importing openai's universe, i get these errors:
Traceback (most recent call last):
File "/Users/calvin/Desktop/universe-test/main.py", line 2, in <module>
import universe
File "/Users/calvin/universe/universe/__init__.py", line 22, in <module>
from universe import error, envs
File "/Users/calvin/universe/universe/envs/__init__.py", line 1, in <module>
import universe.envs.vnc_env
File "/Users/calvin/universe/universe/envs/vnc_env.py", line 11, in <module>
from universe.envs import diagnostics
File "/Users/calvin/universe/universe/envs/diagnostics.py", line 94
async = self.qr_pool.apply_async(self.method, (self._last_img, time.time(), available_at))
^
SyntaxError: invalid syntax
I've tried downloading a different version of gym, reinstalling universe, and nothing works. I have python 3.8.5 64-bit. My operating system is macOS Catalina 10.15.6. Any ideas?
async is now a special keyword, and as such, can't be used as a variable name.
That library appears to be made for Python pre-3.5. I believe your only options are:
Use a older version of Python 3 (async was intrduced in 3.5).
Edit the local copy of the library file to change the name to something else.
Check to see if there are any updates/forks to the library that fix that issue.

Python StanfordNLP package errors on importing the library

I just installed the python stanford nlp which went fine :-
pip install stanfordnlp
from a python shell, I am trying to instantiate the package and I get the following error :-
>>> import stanfordnlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/__init__.py", line 1, in <module>
from stanfordnlp.pipeline.core import Pipeline
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/core.py", line 9, in <module>
from stanfordnlp.pipeline.doc import Document
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/doc.py", line 175
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
^
SyntaxError: invalid syntax
The line:
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
Indicates that the package is intended for Python 3.6 or higher. It is returning an f-string, which was introduced in version 3.6. You are running on version 2.7.
Time to upgrade?

How to install pydelicious?

Im using on my windows python 3.3.2 I have a problem to instal pydelicious API. I was trying to make it work for a whole week but I couldnt make it happen.
This is my problem:
C:\Users\bartl\Desktop\python-delicious-master>python setup.py install
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import pydelicious
File "C:\Users\bartl\Desktop\python-delicious-master\pydelicious\__init__.py", line 171
raise DeliciousItemExistsError, params['url']
^
SyntaxError: invalid syntax
Can somebody help me?
Replace the __init__.py in the python-delicious-master/pydelicious/.
Here is the link for __init__.py, https://github.com/pcao10/pydelicious/issues/43
It works for me!

Error installing selenium python

Getting this error when running pip install -U selenium. Mid way through the script, it gets the following SyntaxError:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Since it is a Syntax Error, I assume it is a python version problem, I'm running 3.2.2.
Pip did come with a pip-3.2.exe file, which I tried to run. But I got the same error. I'm pretty new to Python so it might be something simple.
And how can it be a syntaxError? pip is an already made program.
Running Win7, Python 3.2.2
Selenium does not support Python 3. Use Python 2.7 instead.
Sadly, almost all Python software requires Python 2.x.
[Update]
Selenium supports Python 3.x now.

Categories

Resources