相关疑难解决方法(0)

处理Windows中的子进程崩溃

我正在从Windows命令提示符运行python脚本.它调用下面的函数,它使用LAME将MP3文件转换为波形文件.

def convert_mp3_to_wav(input_filename, output_filename):
    """
    converts the incoming mp3 file to wave file
    """
    if not os.path.exists(input_filename):
        raise AudioProcessingException, "file %s does not exist" % input_filename

    command = ["lame", "--silent", "--decode", input_filename, output_filename]

    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (stdout, stderr) = process.communicate()

    if process.returncode != 0 or not os.path.exists(output_filename):
        raise AudioProcessingException, stdout

    return output_filename
Run Code Online (Sandbox Code Playgroud)

不幸的是,LAME总是在某些MP3上崩溃(并且不辜负它的名字).出现Windows"你的程序已崩溃"对话框,冻结了我的脚本.关闭Windows对话框后,将引发AudioProcessingException.我不想告诉Windows关闭,我只是喜欢脚本来引发异常,然后移动到下一个MP3.

有没有办法解决?最好是通过改变脚本而不是用Unix运行它.

我使用的是Windows 7和Python 2.6

python subprocess

18
推荐指数
1
解决办法
6486
查看次数

可以禁用"应用程序错误"对话框吗?

我使用Hudson作为持续集成服务器来测试C/C++代码.不幸的是,我有一个导致内存损坏的错误,所以在某些Windows机器上,我有时会得到一个"应用程序错误"对话框,说明一条指令引用了无法读取的内存.弹出此对话框并基本挂起测试运行,因为它需要手动干预.

有没有办法阻止此对话框出现,以便测试运行只是失败并在Hudson中报告?

是否可以自动生成小型转储而不是显示对话框?

c++ memory windows debugging build-automation

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

build-automation ×1

c++ ×1

debugging ×1

memory ×1

python ×1

subprocess ×1

windows ×1