使用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 ...
随机推荐
- JS判断是否来自手机移动端的访问,并跳转
var browserName_ = navigator.userAgent ; &&browserName_.indexOf(&&browserName_.index ...
- Mac OS X 上Lua的安装方法
先在Mac OS的终端查询下本机是否已安装Lua Last login: Thu Jul 10 07:54:48 on ttys000 keshans-Mac-mini:~ keshan$ lua - ...
- 安装初始化mysql后,默认几个库介绍
背景介绍: 当我们安装初始化mysql后,默认建了几个数据库,那么这些数据库有什么作用呢?mysql> show databases;+--------------------+| Datab ...
- phoenix创建二级索引
create table user (id varchar primary key, firstname varchar, lastname varchar); create index user_i ...
- 一篇关于SpringMVC 传统文件上传的方法
一.界面效果 二.html代码 <legend>上传APK文件</legend> <form action="<%=basePath%>/apks/ ...
- ubuntu下安装php memcache扩展
memcached 安装sudo apt-get install memcached memcached 参数说明memcached -d -m 50 -p 11211 -u root-m 指定使用多 ...
- 根据 MySQL 状态优化 ---- 1. 慢查询
查看 MySQL 服务器运行的各种状态值: mysql> show global status: 1. 慢查询 mysql> show variables like '%slow%'; + ...
- VPS及LNMP(一)
1.试用了搬瓦工.interserver.天翼云.网安互联之后,分别写下感受: 前两个是美国服务器,天翼云是国内服务器,网安互联是香港主机. a.搬瓦工非常便宜,512M的1年9.99刀,但是用了之后 ...
- Oracle中的表构造导出到word Sql语句
select * from ( SELECT t1.Table_Name AS "表名称", t3.comments AS "表说明", t1.Column_ ...
- Spark SQL External Data Sources JDBC官方实现写测试
通过Spark SQL External Data Sources JDBC实现将RDD的数据写入到MySQL数据库中. jdbc.scala重要API介绍: /** * Save this RDD ...