主要是遇到 Error 24, too many open files.

下面这种方法可以debug打开了哪些文件。

import __builtin__
openfiles = set()
oldfile = __builtin__.file
class newfile(oldfile):
def __init__(self, *args, **kwargs):
self.x = args[0]
print "### OPENING %s ###" % str(self.x)
oldfile.__init__(self, *args, **kwargs)
openfiles.add(self) def close(self):
print "### CLOSING %s ###" % str(self.x)
oldfile.close(self)
openfiles.remove(self)
oldopen = __builtin__.open
def newopen(*args):
return newfile(*args, **kwargs)
__builtin__.file = newfile
__builtin__.open = newopen def printOpenFiles():
print "### %d OPEN FILES: [%s]" % (len(openfiles), ", ".join(f.x for f in openfiles))

可以使用 lsof -p 26530 | grep 'wav' >info.txt 查看进程26530的打开文件情况。

python debug open_files的更多相关文章

  1. 极简Python DeBug工具——PySnooper

    DeBug Python 代码的方式有很多种?比如: (1)设置断点 (2)print函数 (3)... 本文要介绍的是一个新开源的项目PySnooper ,只要给有疑问的代码加上装饰器,各种信息一目 ...

  2. Python Debug工具

    最近在github上冒出了一个python的debug神器PySnooper,号称在debug时可以消灭print.那么该工具有哪些优点呢,如何使用该工具呢.本文就介绍该工具的优缺点和使用方式. 前言 ...

  3. python Debug 单步调试

    一直犯愁的是python的调试,曾经写c都是编译完了用gdb直接调试了,轻松愉快.如今遇到这么一个解释型的程序.不知道怎么办了.用log吧,有时就是一个小程序,不想写这么多代码.打屏吧.有时屏幕翻得快 ...

  4. python debug小技巧&&工程能力的几点建议

    Debug小技巧: 转载请声明本文的引用出处:仰望大牛的小清新 1.初次编程时,在每一个if后面都写上else,这样,如果你的else原本是不应该运行的,那么就可以在else中输出此时的状态信息便于排 ...

  5. [Python Debug]Kernel Crash While Running Neural Network with Keras|Jupyter Notebook运行Keras服务器宕机原因及解决方法

    最近做Machine Learning作业,要在Jupyter Notebook上用Keras搭建Neural Network.结果连最简单的一层神经网络都运行不了,更奇怪的是我先用iris数据集跑了 ...

  6. [Python Debug] How to install external python package? MAC系统下的xgboost安装

    从昨天晚上开始安装xgboost,经历了各种稀奇古怪的错误,终于现在程序可以跑起来了.整个过程对python编译环境,路径设置,package安装方法有了一定了解,当然还有一些疑惑,所以姑且做个记录. ...

  7. python debug调试

    ------------恢复内容开始------------ 一.debug 1.step over f8(单步调试) 2.进入到下一个断点 3.运行到指定行 4.进入到对应的代码行,(和单步调试配合 ...

  8. Python debug

  9. Python debug 调试;

    F9:执行跳到下一个断点 F8:执行下一步 F7:进入函数

随机推荐

  1. 64_m1

    MAKEDEV-3.24-18.fc26.x86_64.rpm 13-Feb-2017 22:33 101030 MUMPS-5.0.2-8.fc26.i686.rpm 14-Feb-2017 13: ...

  2. Linux配置Tomcat

    系统:Ubuntu,Tomcat:apache-tomcat-8.5.23.tar.gz 1,找到apache-tomcat-8.5.23.tar.gz,复制到 /usr/local root@ubu ...

  3. FineReport——JS二次开发(工具栏按钮事件及说明)

    首先获取到这个模板对象: document.getElementById('reportFrame').contentWindow.contentPane.方法名称(); 方法以及说明:

  4. 【python】配置文件

    来源:http://developer.51cto.com/art/201003/189885.htm python 读写配置文件在实际应用中具有十分强大的功能,在实际的操作中也有相当简捷的操作方案, ...

  5. [转]nginx启动期都做了哪些事

    nginx是个多进程web容器,不同的配置下它的启动方式也是不同的,这里我只说说最典型的启动方式. 它有1个master进程,和多个worker进程(最优配置的数量与CPU核数相关).那么,首先我们要 ...

  6. LeetCode解题报告—— 2 Keys Keyboard & Longest Palindromic Substring & ZigZag Conversion

    1. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You ...

  7. hdu5731

    先求出不考虑分割线的n*m棋盘的覆盖方案数记为f[n][m] 然后枚举列分割线的状态(状压),计算此时不存在行分割线的方案数 求出这个我们就可以用容斥原理算出答案了 怎么算在列分割线确定的情况下,不存 ...

  8. LR运行场景时出现的error

    LR运行场景时出现的error 1.Action.c(24): Error -27740: Overlapped transmission of request to "home.asiai ...

  9. 【我要学python】面对对象编程之继承和多态

    class animal(object): def run(): print('animal is running...') class dog(animal): def run(self): pri ...

  10. Vue 2.0 Application Sample

    ===搭建Demo=== http://blog.csdn.net/wangjiaohome/article/details/51728217 ===单页Application=== http://b ...