使用python的subprocess启动windows程序提示WindowsError: [Error 6] The handle is invalid
代码如下:
subp = subprocess.Popen(cwd_path + "test.exe", cwd = cwd_path, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
执行时,从异常捕获中看到错误 WindowsError: [Error 6] The handle is invalid
最后在 https://bugs.python.org/issue3905 找到了解决方法
Specifying PIPE for all subprocess.Popen handles is the only way I've
found to get around this problem:p = subprocess.Popen(["python", "-c", "print 32"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.stdin.close()
subp = subprocess.Popen(cwd_path + "test.exe", cwd = cwd_path, shell = True, stdin=subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) subp.stdin.close()
使用python的subprocess启动windows程序提示WindowsError: [Error 6] The handle is invalid的更多相关文章
- 解决PEnetwork启动的时候提示"An error occured while starting the "TCP/IP Registry Compatibility" Service (2)!"程序将立即退出的问题
解决PEnetwork启动的时候提示"An error occured while starting the "TCP/IP Registry Compatibility" ...
- 启动Windows防火墙提示“0x8007042c"
win8.1 启动防火墙是报错:启动Windows防火墙提示“0x8007042c" 一.检查服务 1,右击开始->运行->输入“services.msc” 打开服务 在框中找到 ...
- 工作自动化,替代手工操作,使用python操作MFC、windows程序
目录 背景--为什么要自动化操作? 方法--怎么实现自动化操作? 查找窗体 发送消息 获取文本 总结 背景--为什么要自动化操作? 工作中总是遇到反复重复性的工作?怎么用程序把它变成自动化操作?将程序 ...
- 通过weburl 启动windows程序
1. 注册表修改 建立一个reg文件 执行导入 以RunLocal协议为例子 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\RunL ...
- windows下启动某程序提示缺失**.dll文件的处理方法
一.背景: 1.os : windows7 64bit 旗舰版 2.启动ftp服务端软件时提示缺失mfc100.dll文件 以上情形亲测有效 二.修复 2.1 从https://cn.dll-file ...
- 如何在python脚本下启动django程序
直接上图
- 启动eclipse时候提示错误Error:Could not create the Java Virtual Machine. Error:A Fatal exception has occurred,Program will exit.
我的是neon3版本 解决办法是: 首先把这两个选项勾选,才能看到eclipse.ini完整的文件名.然后用记事本等工具打开编辑. 新版的里面原本是这样: -startup plugins/org.e ...
- subprocess.Popen运行报错WindowsError: [Error 740]
subprocess.Popen在win10下运行报740错时 使用os.popen替换,运行OK,exe程序成功启动 import subprocess import uiautomation as ...
- SpringBoot启动项目时提示:Error:(3, 32) java: 程序包org.springframework.boot不存在
场景 在IDEA中新建SpringBoot项目,后启动项目时提示: Error:(3, 32) java: 程序包org.springframework.boot不存在 实现 将pom.xml中par ...
随机推荐
- 格式化用户输入的金额(处理RMB的时候适合)
number_format($str,'2','.',','); function number($k){ if(strpos($k,'.')===false){ $ok = $k.'; }else{ ...
- Fragment +ViewPager
public class MainActivity extends FragmentActivity { private ViewPager vp; @Override protected vo ...
- oracle 查询数据库表空间大小和剩余空间
dba_data_files:数据库数据文件信息表.可以统计表空间大小(总空间大小). dba_free_space:可以统计剩余表空间大小. 增加表空间即向表空间增加数据文件,表空间大小就是数据文件 ...
- 配置recovery_min_apply_delay后重启standby节点报错:psql: FATAL: the database system is starting up
环境: pg版本:PostgreSQL 9.4.4 on x86_64 系统版本:CentOS release 6.6 linux内核版本:2.6.32-504.8.1.el6.x86_64 今天测试 ...
- 39:第n小的质数
39:第n小的质数 总时间限制: 1000ms 内存限制: 65536kB描述 输入一个正整数n,求第n小的质数.输入 一个不超过10000的正整数n.输出 ...
- MongoDB丢数据问题的分析
坊间有很多传说MongoDB会丢数据.特别是最近有一个InfoQ翻译的Sven的一篇水文(为什么叫做水文?因为里面并没有他自己的原创,只是搜罗了一些网上的博客,炒了些冷饭吃),其中又提到了丢数据的事情 ...
- [solr] - Facet - autocomplete
Solr的facet可以用于一般性的前缀式自动完成功能,当然,它的主要功能是用于做统计.分类.区间等. 统计.分类.区间功能,可参考下文: http://hongweiyi.com/2013/03/a ...
- Python Mysql 篇
Python 操作 Mysql 模块的安装 linux: yum install MySQL-python window: http://files.cnblogs.com/files/wupeiqi ...
- eclipse下新建maven项目
eclipse下新建maven项目 1.1下载maven安装包 进入Maven官网的下载页面:http://maven.apache.org/download.cgi,如下图所示:\ 选择当前最新版本 ...
- str转unsigned int
用法 1 参数:参数类型为char, 十六进制字符串形式:0X××××××[NUT],十进制字符串形式:×××××××[NUT],字符串的最大长度为16,字符串结尾符必须为ascii码值0(NUT). ...