Linux | Python | `OSError:[Errno 2]没有这样的文件或目录`& `MemoryError`

时间:2017-08-14 05:10:02

标签: python linux python-2.7

root@raspberrypi:/home/pi/Downloads/dejavu# python2 ./example.py
######## filename: mp3/Brad-Sucks--Total-Breakdown.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "/home/pi/Downloads/dejavu/dejavu/__init__.py", line 79, in fingerprint_d   irectory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 659, in next
    raise value
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "./example.py", line 17, in <module>
    song = djv.recognize(FileRecognizer, "/home/pi/Downloads/dejavu/mp3/Brad-Suc   ks--Total-Breakdown.mp3")
  File "/home/pi/Downloads/dejavu/dejavu/__init__.py", line 169, in recognize
    return r.recognize(*options, **kwoptions)
  File "/home/pi/Downloads/dejavu/dejavu/recognize.py", line 41, in recognize
    return self.recognize_file(filename)
  File "/home/pi/Downloads/dejavu/dejavu/recognize.py", line 29, in recognize_fi   le
    frames, self.Fs, file_hash = decoder.read(filename, self.dejavu.limit)
  File "/home/pi/Downloads/dejavu/dejavu/decoder.py", line 51, in read
    audiofile = AudioSegment.from_file(filename)
  File "/usr/local/lib/python2.7/dist-packages/pydub/audio_segment.py", line 505   , in from_file
    p = subprocess.Popen(conversion_command, stdout=subprocess.PIPE, stderr=subp   rocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

任何人都可以帮助我吗?我是一个关于蟒蛇的新人。

我想运行一个Python项目,在Raspberry pi零W中证明是正确的,它上面的系统是像Debian一样的linux,我已经安装了Python 2和python 3。

当我杀死上述错误时,出现了另一个错误,如下所示:

root@raspberrypi:/home/pi/Downloads/dejavu# python2 example.py                     ######## filename: mp3/Brad-Sucks--Total-Breakdown.mp3
Fingerprinting channel 1/2 for mp3/Brad-Sucks--Total-Breakdown.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "/home/pi/Downloads/dejavu/dejavu/__init__.py", line 79, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 659, in next
    raise value
MemoryError
Traceback (most recent call last):
  File "example.py", line 17, in <module>
    song = djv.recognize(FileRecognizer, "/home/pi/Downloads/dejavu/mp3/Brad-Sucks--Total-Breakdown.mp3")
  File "/home/pi/Downloads/dejavu/dejavu/__init__.py", line 169, in recognize
    return r.recognize(*options, **kwoptions)
  File "/home/pi/Downloads/dejavu/dejavu/recognize.py", line 41, in recognize
    return self.recognize_file(filename)
  File "/home/pi/Downloads/dejavu/dejavu/recognize.py", line 32, in recognize_file
    match = self._recognize(*frames)
  File "/home/pi/Downloads/dejavu/dejavu/recognize.py", line 17, in _recognize
    matches.extend(self.dejavu.find_matches(d, Fs=self.Fs))
  File "/home/pi/Downloads/dejavu/dejavu/__init__.py", line 118, in find_matches
    hashes = fingerprint.fingerprint(samples, Fs=Fs)
  File "/home/pi/Downloads/dejavu/dejavu/fingerprint.py", line 83, in fingerprint
    noverlap=int(wsize * wratio))[0]
  File "/usr/lib/python2.7/dist-packages/matplotlib/mlab.py", line 1315, in specgram
    mode=mode)
  File "/usr/lib/python2.7/dist-packages/matplotlib/mlab.py", line 759, in _spectral_helper
    result = np.conjugate(result) * result
MemoryError

以前有人遇到类似问题吗?

1 个答案:

答案 0 :(得分:0)

解决OSError: [Errno 2] No such file or directory

的方法

安装FFmpegLibav

原因FFmpeg几乎被Linux退出,我安装了Libva

sudo apt-get install libav-tools

解决MemoryError

的方法

将小型mp3文件更改为指纹并重新识别

因为我的CPU的RAM太小而无法处理大文件