1、调用系统库 platform.system() 报错:

2、os.popen() 打开的文件流未关闭也会出现这种错误。

f = os.popen()

f.read()

f.close()

问题复现的场景:如果在主进程->开启一个子线程调用os.popen(),主进程会回收os.popen()

如果主进程--> 开启线程1 ,线程1开启一个线程2来调用os.popen(),主进程回收os.popen()时,发现线程2不存在,则会出现以上问题。

【Reference】

1、https://blog.csdn.net/Joseph_1118/article/details/17721273

2、http://www.ojit.com/article/1517584

3、https://www.linuxidc.com/Linux/2011-10/45919p3.htm

python os.popen('xxx.py') 遇到的坑 (No Child Processes)的更多相关文章

  1. 【转】python os.popen 超时问题

    python 版本 2.5.4 (在高版本python中提倡使用 subprocess.Popen 取代 os.popen) os.popen 会出现过长时间等待导致阻塞问题, 解决方法如下: [py ...

  2. Python os.popen() 方法

    简述 就是新建一个管道执行一个命令. 方法是os.popen(命令,权限,缓冲大小) 比如 a = 'mkdir def' b = os.popen(a,) print b 就是等同于使用命令去创建了 ...

  3. python os.popen 乱码问题

    os.popen('ipconfig') 命令返回的结果在调试时乱码了: output1 = os.popen('ipconfig') o1=output1.read() 我猜这里输出的内容要和控制台 ...

  4. python使用 pdb 进行调试--- python -m pdb xxx.py 即可 和gdb使用一样

    使用 pdb 进行调试 pdb 是 python 自带的一个包,为 python 程序提供了一种交互的源代码调试功能,主要特性包括设置断点.单步调试.进入函数调试.查看当前代码.查看栈片段.动态改变变 ...

  5. Python os.system 和 os.popen的区别

    (1) os.system # 仅仅在一个子终端运行系统命令,而不能获取命令执行后的返回信息 system(command) -> exit_statusExecute the command ...

  6. os.system() 和 os.popen()

    1.os.popen(command[, mode[, bufsize]])  os.system(command) 2.os.popen() 功能强于os.system() , os.popen() ...

  7. os.popen('python hello_out.py')中Python程序执行时默认的当前路径为MS-DOS CMD的默认路径

    >>> import os >>> os.getcwd() 'D:\\pythonCode\\pp4e' >>> os.chdir('Stream ...

  8. python os.system()和os.popen()

    1>python调用Shell脚本,有两种方法:os.system()和os.popen(),前者返回值是脚本的退出状态码,后者的返回值是脚本执行过程中的输出内容.>>>hel ...

  9. python笔记16-执行cmd指令(os.system和os.popen)

    os.system 1.如果想在cmd执行python脚本,可以直接用如下指令 python [xx.py绝对路径] 比如我写了个hello.py的脚本,在脚本里面写入内容:print("h ...

随机推荐

  1. JAVA 时间转换、获取

    /** * 将字符串格式的时间转换成Timestamp * * @param time * @param formatStyle * @return */ public static Timestam ...

  2. P1850 换教室[dp+期望]

    流下了不会概率的眼泪,由于不会概率,转移少写了点东西... 这个dp很简单,就是一个普通的线性dp加点期望.(刚开始写这道题时信笔写下) \(dp[0/1][i][j]\)表示到第\(i\)个时间段时 ...

  3. oracle安装11g以及建账号等等

    Oracle 11g安装步骤详解 一.Oracle 下载 注意Oracle分成两个文件,下载完后,将两个文件解压到同一目录下即可. 路径名称中,最好不要出现中文,也不要出现空格等不规则字符. 官方下地 ...

  4. Flutter 数据存储之 shared_preferences

    资源名称 网址 github https://github.com/flutter/plugins/tree/master/packages/shared_preferences Flutter 数据 ...

  5. Sitemap Error : XML declaration allowed only at the start of the document解决方法

    今天ytkah的客户反馈说他的xml网站地图有问题,提示Sitemap Error : XML declaration allowed only at the start of the documen ...

  6. 一台服务器配置多个TOMCAT

    如果要在一台服务器上配置多个Tomcat,主要就是要避免Tomcat服务器的端口冲突的问题.只需要修改CATALINA_HOME\conf\server.xml中的启动端口和连接端口就OK了! 下面我 ...

  7. Java Array、List、Set互相转化

    https://blog.csdn.net/u014532901/article/details/78820124

  8. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

    十月 30, 2019 11:12:35 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending ...

  9. BZOJ 4903: [Ctsc2017]吉夫特 数论+dp

    思路很巧妙的一道题 ~ 这个应该不完全是正解,复杂度约为 $O(3\times 10^8)$,有时间再研究研究正解. 首先,最裸的暴力是按照权值从小到大枚举每一个数,然后枚举后面的数来更新方案数,是 ...

  10. [RN] React Native 使用精美图标库react-native-vector-icons

    React Native 使用精美图标库react-native-vector-icons 一.安装依赖 npm install --save react-native-vector-icons // ...