用Idle运行Python脚本的时候发现如下错误:

Traceback (most recent call last):

File "C:\Users\DangKai\Desktop\pythonUI-unittest-selenium\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start

stdin=PIPE)

File "D:\Software\Python37\lib\subprocess.py", line 756, in init

restore_signals, start_new_session)

File "D:\Software\Python37\lib\subprocess.py", line 1155, in _execute_child

startupinfo)

FileNotFoundError: [WinError 2] 系统找不到指定的文件。

后来在stackoverflow上找到如下解决办法:

In Windows , to use echo in subprocess, you would need to use shell=True . This is because echo is not a separate executable, but rather a built-in command for the windows command line. Example - 在windows 在子进程中使用echo,需要设置 shell =True,因为 echo 不是单独的命令,而是window CMD 内置的命令

process1 = subprocess.Popen(command1,stdout=subprocess.PIPE,shell=True)

Also, please do note, you should only use shell=True when absolutely necessary (as in this case , to use echo in windows in subprocess).

并且,需要注意,只有在绝对需要的情况下才使用shell=True

找到 subprocess.py脚本,将对应行加上shell=true 参数

FileNotFoundError: [WinError 2] 系统找不到指定的文件。 解决方案的更多相关文章

  1. python FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    D:\Test\TestSWP\Scripts\python.exe D:/Test/SWP/TestSWP/chorme/chorme.pyTraceback (most recent call l ...

  2. 路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法

    执行python + selenium 代码 from selenium import webdriver driver = webdriver.Chrome("D:\AutoConf\bi ...

  3. 在使用selenium时出现FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    今天在使用selenium出现这样的错: Traceback (most recent call last): File "E:\python\lib\site-packages\selen ...

  4. FileNotFoundError: [WinError 2] 系统找不到指定的文件

    用Idle运行Python脚本的时候发现如下错误: Traceback (most recent call last):  File "D:\Python\Python36-32\lib\s ...

  5. pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path && FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    C:\Users\k\Desktop\test>python test.py Traceback (most recent call last): File , in run_tesseract ...

  6. 转换文件格式遭遇 FileNotFoundError:[WinError 2]系统找不到指定的文件

    重启试试

  7. TextClip构造方法报OSError:MoviePy creation of None failed because of the following [WinError 2]系统找不到指定的文件

    ☞ ░ 前往老猿Python博文目录 ░ 在使用moviepy的构造方法创建实例时报错: "C:\Program Files\Python37\python.exe" F:/stu ...

  8. [Python学习]错误篇二:切换当前工作目录时出错——FileNotFoundError: [WinError 3] 系统找不到指定的路径

    REFERENCE:<Head First Python> ID:我的第二篇[Python学习] BIRTHDAY:2019.7.13 EXPERIENCE_SHARING:解决切换当前工 ...

  9. building '_mysql' extension error: [WinError 2] 系统找不到指定的文件。

    D:\4yanjiiu\APIzidong\MySQL-python-1.2.5>py running install running bdist_egg running egg_info wr ...

随机推荐

  1. ca70a_c++_重载函数_实参类型转换

    /*ca70a_c++_重载函数_实参类型转换转换等级,详见P290 编译选择哪个函数版本呢?1.精确匹配2.通过类型提升3.通过标准转换4.通过类类型转换参数匹配和枚举类型重载和const形参 vo ...

  2. Mysql表结构转成Oracle

    Navicat数据库连接工具

  3. django 网站域名解析 IP绑定 新建站 新域名

    备案成功后,我们要用域名来访问服务器,这个不仅要修改nginx的配置文件,还要设置域名的解析,下面是我的一个调试经验过程:直接上图了. 1.问题查找

  4. v-on事件修饰符

    .stop阻止冒泡 .prevent阻止默认行为 .capture实现捕获触发事件的机制(从大到小) .self实现只有点击当前元素时,才能出发事件处理函数 .once只触发一次事件函数 .stop和 ...

  5. 【DMCP】2020-CVPR-DMCP Differentiable Markov Channel Pruning for Neural Networks-论文阅读

    DMCP 2020-CVPR-DMCP Differentiable Markov Channel Pruning for Neural Networks Shaopeng Guo(sensetime ...

  6. 使用Jmeter如何测试下载接口

    性能测试过程中,有时候需要对下载类的功能做压测,有些同学没有这方面的测试经验,比较迷茫,本文简单介绍下如何测试下载类的请求1.首先使用fiddler抓包,知道是一个http类型的请求,有一个post请 ...

  7. Linux中bash的一些命令

    Linux——bash的简单使用 bash及其特性: 1.bash实质上是一个可执行的程序,一个用户的工作环境. 2.每一个shell下可以再打开一个shell,新打开的shell称为子shell,每 ...

  8. 一场由yield引发的连串拷问

    最近在学习Python中生成器时,遇到了一个yield关键词,廖雪峰老师的官网中也没有详细的解释,经过一番查阅和研究,终于对它有了一些认识并做了总结(如有不对之处,还请大神指正). 首先先简单了解下生 ...

  9. SQL注入之MySQL常用的查询语句

    MySQL是一种使用很广的数据库,大部分网站都是用MySQL,所以熟悉对MySQL数据库的注入很重要. 首先来说下MySQL注入的相关知识点 在MySQL5.0版本之后,MySQL默认在数据库存放一个 ...

  10. 【原】二进制部署 k8s 1.18.3

    二进制部署 k8s 1.18.3 1.相关前置信息 1.1 版本信息 kube_version: v1.18.3 etcd_version: v3.4.9 flannel: v0.12.0 cored ...