Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyDub-[WinError 6]在使用AudioSegment.from_文件时,句柄无效_Python_Pyinstaller_Python 3.7_Pydub - Fatal编程技术网

Python PyDub-[WinError 6]在使用AudioSegment.from_文件时,句柄无效

Python PyDub-[WinError 6]在使用AudioSegment.from_文件时,句柄无效,python,pyinstaller,python-3.7,pydub,Python,Pyinstaller,Python 3.7,Pydub,我想将音频文件从一种格式转换为另一种格式,所以我使用了Pydub AudioSegment AudioSegment.from_file(input_filename, 'mp4') python脚本文件运行得很好,但当我使用pyinstaller将其捆绑为可执行文件时,会出现以下错误 我通读了Github问题页面,并实现了那里建议的解决方案,但这似乎不起作用。我已将ffmpeg.exe和ffprobe.exe放在我的项目目录中,并使用AudioSegment.converter设置路径

我想将音频文件从一种格式转换为另一种格式,所以我使用了Pydub AudioSegment

AudioSegment.from_file(input_filename, 'mp4')
python脚本文件运行得很好,但当我使用pyinstaller将其捆绑为可执行文件时,会出现以下错误

我通读了Github问题页面,并实现了那里建议的解决方案,但这似乎不起作用。我已将ffmpeg.exe和ffprobe.exe放在我的项目目录中,并使用AudioSegment.converter设置路径

   Traceback (most recent call last):
      File "main.py", line 91, in change_format
        converted_audio = AudioSegment.from_file(input_filename, 'mp4')
      File "lib\site-packages\pydub\audio_segment.py", line 685, in from_file
      File "lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
      File "subprocess.py", line 728, in __init__
      File "subprocess.py", line 1025, in _get_handles
    OSError: [WinError 6] The handle is invalid

请建议解决此问题的方法。

sysinternals中的procmon
可能会为您提供一些有用的信息如何运行可执行文件?您正在重定向其输出吗?另外,您使用的是哪个windows版本?这看起来像是Windows问题。我使用的是Windows 10。您可以根据以下示例编辑子流程调用: