所以有人写了一个笑话陷阱脚本(如“陷阱音乐”),我无法让它工作。
usage: trapifier.py [-h] [--samples [SAMPLES]] inputfile outputfile
然而,尽管文件夹看起来像这样
ls -l
total 14288
-rwxrwxrwx 1 ________ ________ 7295612 Mar 2 2008 Chicago.mp3
-rwxr-xr-x@ 1 ________ ________ 1074 Apr 12 17:00 LICENSE
-rwxr-xr-x@ 1 ________ ________ 2871 Apr 12 17:00 README.md
-rwxr-xr-x@ 1 ________ ________ 6 Apr 12 17:00 requirements.txt
drwxr-xr-x@ 48 ________ ________ 1632 Apr 12 17:00 samples
-rwxr-xr-x 1 ________ ________ 2923 Apr 12 17:00 trapifier.py
此命令总是导致 [Errno 2] No such file or directory
./trapifier.py Chicago.mp3 Chiraq.mp3
或者
python trapifier.py Chicago.mp3 Chiraq.mp3
甚至
./trapifier.py /full/path/to/Chicago.mp3 Chiraq.mp3
是什么赋予了?我觉得某处有一个新手错误。
请求的完整错误消息:
Traceback (most recent call last):
File "./trapifier.py", line 89, in <module>
overlay(parse())
File "./trapifier.py", line 32, in parse
base_track = pydub.AudioSegment.from_mp3(inputfile)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydub/audio_segment.py", line 297, in from_mp3
return cls.from_file(file, 'mp3')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydub/audio_segment.py", line 284, in from_file
subprocess.call(convertion_command, stderr=open(os.devnull))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
脚本的来源托管在https://github.com/japesinator/trapifier.py
我拥有所有必需的库(argparse、pydub、os、random)。
第一个有用的编辑: pydub.AudioSegment 加载失败似乎是罪魁祸首。然而,事情变得陌生了。在 python 终端中,我可以做
from pydub import AudioSegment
但是当我这样做时,我得到一个没有这样的模块错误
导入 pydub.AudioSegment