跟踪python:仅包含一些文件 [英] trace python: only include some files

查看:59
本文介绍了跟踪python:仅包含一些文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用它来跟踪命令执行:

I know that I can use this to trace the command execution:

python -m trace -t script.py

但是我想减少输出:仅显示src/中的文件(pip install -e ...).

But I want to reduce the output: Only files which are in my src/ (pip install -e ...) should be shown.

我该怎么做?

推荐答案

我的解决方案基于Brian Cain的回答:

My solution is based on the answer of Brian Cain:

export PYTHONIOENCODING=utf-8
python -m trace --ignore-dir=$HOME/lib64:$HOME/lib:/usr -t script.py

我的virtualenv直接在$ HOME中,并且我的代码可编辑地安装在$ HOME/src中.

My virtualenv is directly in $HOME and my code is installed editable in $HOME/src.

需要此 PYTHONIOENCODING = utf-8; ,因为如果python代码中存在非ASCII字符,则会出现UnicodeErrors.

This PYTHONIOENCODING=utf-8; is needed since I got UnicodeErrors if there where non ascii characters in the python code.

这篇关于跟踪python:仅包含一些文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆