当启动我的 Python 脚本时,我收到此警告:
/usr/lib/python2.7/dist-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)
% self._get_c_name())
我知道我可以像这样忽略这个警告:
PYTHONWARNINGS="ignore::UserWarning" python $MYSCRIPT
但这也将忽略我仍然希望看到的所有其他模块的 UserWarnings。 是否可以以更细粒度的方式指定忽略,例如传递应抑制警告的模块名称?
最佳答案
这将仅通过命令行忽略模块 cffi.model
的 UserWarnings:
PYTHONWARNINGS="ignore::UserWarning:cffi.model" python $MYSCRIPT
关于python - 通过命令行仅针对特定模块禁用 python 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37158090/