이 코드를 실행하려고하는데 다음 오류가 발생합니다. Error : AudioFileOpen failed ('wht?'). 그 어떤 도움 경우 그래서 여기 내 코드는 - 그것은 맥과 MP3 파일의 폴더와 실행중인 것 :파이썬 - 'Error : AudioFileOpen failed ('wht? ') 의미는 무엇입니까?
어떤 도움을 환영 크게 귀하의 질문에서
-3
A
답변
0
(이에서보세요 감사한다
import os
def randomShuffleSongFromFolder(folderPath):
try:
music = os.listdir(folderPath)
except:
print('Error-Music folder not found')
exit()
random.shuffle(music)
music.remove('.DS_Store')
print(folderPath)
print(music)
for song in music:
os.system('afplay "' + song + '"')
if __name__ == '__main__':
print(os.listdir('/Users/isaac_lims_macbook_air/Desktop/davidMusic'))
randomShuffleSongFromFolder('/Users/isaac_lims_macbook_air/Desktop/MusicExample/')
) :
for song in music:
os.system('afplay "' + song + '"')
및 music
에 포함 된 내용을 기억 : 파일 이름 목록 (예 : "Adele - Hello.mp3"
). . 당신은 당신이보고있는 디렉토리를 이야기하지 않는 afplay
에게 전달하는 경우 (오류 메시지가 파이썬에서 오는되지 않습니다, 오히려 afplay
자체에서, 예를 들어 this other question where the same command is called from C를 참조하십시오.)
포함 os.path.join()
를 사용해보십시오 디렉토리, 예.
import os.path
# Assuming folderPath is being passed into the containing function as above
for song in music:
songPath = os.path.join(folderPath, song)
os.system('afplay "{}"'.format(songPath))
이렇게 afplay
는 "/Users/you/Desktop/Music/Adele - Hello.mp3"
같은 절대 경로를 수신한다.
관련 문제
- 1. Ajax Precondition Failed Error
- 2. Error - Firebase.push failed :
- 3. Blackberry Deployment Failed Error
- 4. "error": HttpURLConnection과 함께 "oauth failed"
- 5. Authenticated failed registration error c2dm
- 6. 파이썬 정규식에서 [- \ w] + 의미는 무엇입니까?
- 7. 파이썬 버전 라인의 의미는 무엇입니까?
- 8. 이 파이썬 구문의 의미는 무엇입니까?
- 9. 파이썬 래퍼 출력의 의미는 무엇입니까?
- 10. 파이썬 문자열 조각에서 + 의미는 무엇입니까?
- 11. 파이썬 코드에서 '@'의 의미는 무엇입니까?
- 12. 파이썬 : 배열 ([...])의 의미는 무엇입니까?
- 13. 파이썬 __super black magic failed
- 14. urlopen error [Errno 11001] getaddrinfo failed
- 15. Wind River Linux, Failed Dependency Error
- 16. ./configure failed, error : Gentoo 정상 검사가 실패했습니다.
- 17. crosswalk-project error 'Building ABI'armeabi-v7a 'failed'
- 18. Gradle sync failed : CreateProcess error = 216
- 19. "CreateFontPackage failed : Win32 error : 1035"에 대한 해결책은 무엇입니까?
- 20. 파이썬 3.1에서 백분율 기호 의미는 무엇입니까
- 21. 파이썬 : - "if (true)"의 의미는 무엇입니까?
- 22. 이 (중복?) 파이썬 표현의 의미는 무엇입니까?
- 23. Java에서 ".class expected error"의 의미는
- 24. fully_connected_feed.py의 "//"의미는 무엇입니까
- 25. PgaSocketWriteAllUnix의 의미는 무엇입니까?
- 26. 파이썬 찾기 로그 파일에 FAILED 숫자 찾기
- 27. 이 문장의 의미는 무엇입니까?
- 28. 파이썬에서 밑줄 의미는 무엇입니까
- 29. libglib을 디버그 모드로로드 할 때 "error : symbol lookup error : undefined symbol :"의 의미는 무엇입니까?
- 30. 문자열에서 $의 의미는 무엇입니까?
아마'playMusic()'에서 온 것일 수 있지만 그 기능이 무엇인지 알 수있는 방법이 없습니다. 확실히 표준 라이브러리가 아닙니다. – Chris