2014-04-13 6 views
2

누군가가 농담 트로피 식별자 스크립트 ('트랩 음악'처럼)를 써서 제대로 작동하지 않습니다.파이썬이 내 파일을 찾을 수없는 이유는 무엇입니까?

usage: trapifier.py [-h] [--samples [SAMPLES]] inputfile outputfile 

그러나, 폴더에도 불구하고이 명령은 항상 [errno를 2] 해당 파일이나 디렉토리

./trapifier.py Chicago.mp3 Chiraq.mp3 

또는

python trapifier.py Chicago.mp3 Chiraq.mp3 
결과이

ls -l 
total 14288 
-rwxrwxrwx 1 ________ ________ 7295612 Mar 2 2008 Chicago.mp3 
[email protected] 1 ________ ________  1074 Apr 12 17:00 LICENSE 
[email protected] 1 ________ ________  2871 Apr 12 17:00 README.md 
[email protected] 1 ________ ________  6 Apr 12 17:00 requirements.txt 
[email protected] 48 ________ ________  1632 Apr 12 17:00 samples 
-rwxr-xr-x 1 ________ ________  2923 Apr 12 17:00 trapifier.py 

처럼 보이는

또는 심지어

./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, 운영 체제, 임의)이있다.

최초의 유용한 편집 : pydub.AudioSegment가로드에 실패한 것이 원인입니다. 그러나 사물은 낯선 사람이됩니다. 파이썬 터미널에서 나는

from pydub import AudioSegment 

을 수행 할 수 있습니다하지만 난 않는 그런 모듈 오류가 발생하지

수입 pydub.AudioSegment

+0

mp3 파일의 전체 경로를 명시 적으로 시도 했습니까? 'C : \ User \ Music \ Chicago.mp3'와 비슷합니다. – CoryKramer

+2

실제 오류 메시지는 무엇입니까? 아마도이 특정 스크립트에 대한 경험이있는 사람이 아무도 없을 것입니다. 실제로 파일을로드하려고 시도하는 코드를 파헤칠 수 있습니까? – SpoonMeiser

+0

'python trapifier.py ./Chicago.mp3./Chiraq.mp3'와 함께 발생하는 일 – jmunsch

답변

3

그것은 pydub 해독하는 데 사용됩니다는 FFmpeg을 찾을 수 없습니다 꽤 흔한 일 mp3 파일 (및 기타 모든 비 웨이브 형식)을 인코딩 할 수 있습니다. 당신는 FFmpeg 설치하고 여전히 사용자가 명시 적으로 어디에과 같이 그것을 찾을 수 pydub을 알 수 있습니다 작동하지 않는 경우 :

from pydub import AudioSegment 
AudioSegment.ffmpeg = "/path/to/ffmpeg" 

당신은 또한 우리의 getting ffmpeg set up docs D = 도움이

편집 찾을 수 있습니다 - 마지막 리조트 옵션을 : 최선의 노력에도 불구하고 ffmpeg를 찾지 못하면 pydub에 파일을 전달하기 전에 모든 것을 wave 형식으로 변환 할 수 있습니다. 이것은 최후의 수단이지만 pydub가 기본적으로 웨이브를 지원하기 때문에 ffmpeg 문제를 피할 수 있습니다.

+0

이 솔루션은 저에게 효과적이지 않으므로 AudioSegment.converter를 AudioSegment.ffmpeg 대신 AudioSegment.converter를 사용해야한다는 사실을 조금 더 깊이 생각했습니다. (https://github.com/jiaaro/pydub/issues/62). –

관련 문제