程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)?

开发过程中遇到WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)的问题如何解决?下面主要结合日常开发的经验,给出你关于WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)的解决方法建议,希望对你解决WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)有所启发或帮助;
from pydub import AudioSegment
from pydub.playBACk import play

sound = AudioSegment.from_mp3("C:/Users/ANTHONY/Desktop/CSV&XLSX/audio_files/mp3_file.mp3")
play(sound)

'---------------------------------------------- ----------------------------- 输出

fileNotFoundError                         TraceBACk (most recent call last)
<ipython-input-18-af62bebf70cc> in <module>
  3 #mp3_file = AudioSegment.from_file("C:/Users/ANTHONY/Desktop/CSV&XLSX/audio_files/mp3_file.mp3")
  4 
----> 5 sound = AudioSegment.from_mp3("C:/Users/ANTHONY/Desktop/CSV&XLSX/audio_files/mp3_file.mp3")
  6 play(sound)

~\anaconda3\lib\site-packages\pydub\audio_segment.py in from_mp3(cls,file,parameters)
736     @classmethod
737     def from_mp3(cls,parameters=NonE):
--> 738         return cls.from_file(file,'mp3',parameters=parameters)
739 
740     @classmethod

~\anaconda3\lib\site-packages\pydub\audio_segment.py in from_file(cls,format,codec,parameters,**kwargs)
683             info = None
684         else:
--> 685             info = mediainfo_Json(orig_file,read_ahead_limit=read_ahead_limit)
686         if info:
687             audio_streams = [x for x in info['streams']

~\anaconda3\lib\site-packages\pydub\utils.py in mediainfo_Json(filepath,read_ahead_limit)
272 
273     command = [prober,'-of','Json'] + command_args
--> 274     res = Popen(command,stdin=stdin_parameter,stdout=PIPE,stderr=PIPE)
275     output,stderr = res.communicate(input=stdin_data)
276     output = output.decode("utf-8",'ignore')

~\anaconda3\lib\subprocess.py in __init__(self,args,bufsize,executable,stdin,stdout,stderr,preexec_fn,close_fds,sHell,cwd,env,universal_newlines,startupinfo,creationflags,restore_signals,start_new_session,pass_fds,enCoding,errors,text)
852                             enCoding=enCoding,errors=errors)
853 
--> 854             self._execute_child(args,855                                 pass_fds,856                                 startupinfo,~\anaconda3\lib\subprocess.py in _execute_child(self,p2cread,p2cwrite,c2pread,c2pwrite,errread,

errwrite、unused_restore_signals、unused_start_new_session) 1305 # 启动进程 1306尝试: -> 1307 hp,ht,pID,tID = _winAPI.CreateProcess(executable,1308#无特殊安全 第1309章 无,无,

fileNotFoundError: [WinError 2] The system cAnnot find the file specifIEd

,目录和文件在那里,当我尝试从它播放的目录中播放 WAV 文件时,这是 MP3 输出

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)全部内容,希望文章能够帮你解决WinError 2 当我尝试播放 mp3 音频文件时,系统找不到指定的文件 (Python)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。