禁用 Pygame 控制台输出
可能的重复:
如何在Python中抑制控制台输出?
目前我正在使用 pygame读取操纵杆输入,我需要解决以下问题。
当调用操纵杆模块中的函数(例如 get_axis()
或 get_button()
)时,该函数会打印出诸如 SDL_JoystickGetButton value:0:
等行需要禁用这些行到控制台的输出。
我在 stackoverflow 上找到了以下问题/答案,这就是我正在寻找的...
但是这篇文章没有提供足够的信息。因为如果我必须关闭调试,我想知道如何做到这一点的步骤。到目前为止,我已经下载了 pygame 源代码并进入了 Joystick.c 并注释掉了打印到控制台的行,然后我运行了 setup.py,但操纵杆功能仍然打印到控制台。我还使用 Python 2.6 和 pygame 1.9.1。
Possible Duplicate:
How to suppress console output in Python?
Currently I am using pygame to read joystick input and I have the following issue that I need to solve.
When calling functions in the joystick module such as get_axis()
or get_button()
the function prints out lines such as SDL_JoystickGetButton value:0:
I need to disable the output of these lines to the console.
I have found the following question/answer on stackoverflow which is what I'm looking for...
How to suppress console output in Python?
But this post does not supply enough information. Because if I have to turn off DEBUG, I would like to know the steps on how to do that. So far I have downloaded the pygame source and went into joystick.c and commented out the lines that print to the console, and then I ran the setup.py, but the joystick functions still print out to the console. Also I am using Python 2.6 and pygame 1.9.1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该线程应该解决这个问题:
printf statements 1.9.1
我遇到了同样的问题,除了运行时在 PyScripter 下,它会导致 PyScripter 本身出现巨大的内存泄漏。所以它耗尽了我机器上的所有内存。讨厌的互动。
This thread should resolve this:
printf statements 1.9.1
I had this same issue except when running under PyScripter it causes a huge memory leak in PyScripter itself. So it was eating up all my memory on my machine. Nasty interaction.