如何使用自定义工具在perforce客户端p4v的日志窗口中输出

发布于 2024-08-28 15:34:47 字数 134 浏览 1 评论 0原文

我们正在用 python 开发 perforce 自定义工具,并在脚本执行期间输出消息。它显示在 p4win 中,但我们主要使用 p4v 并且输出不会显示在日志窗口中。

有没有办法在此处或任何其他窗格中输出,而无需在终端窗口中运行该工具?

We're developing perforce custom tools in python and we're outputting messages during the script execution. It shows up in p4win but we're mainly using p4v and the output doesn't show up in the log window.

Is there a way to output there or in any other pane without resorting to run the tool in a terminal window?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花随流水 2024-09-04 15:34:47

当 Python 将其输出定向到管道而不是直接定向到终端时,它默认缓冲其输出。我认为您可以通过在调用 Python 时传递“-u”参数(例如 python -u myscript.py arg1 arg2 )来告诉它不要缓冲,或者调用 sys.stdout.flush() 贯穿整个脚本,只要您希望它确保输出已到达 P4V。

另请参阅:

http://kb. perforce.com/article/914/sending-script-output-to-p4vs-custom-tool-terminal

(看起来这个问题是在您在 Stack Overflow 上提问后提出并回答的。抱歉,如果您是已经很清楚了。)

When Python is directing its output to a pipe rather than straight to a terminal, it buffers its output by default. I think you can work around this by either passing the "-u" parameter when invoking Python (e.g., python -u myscript.py arg1 arg2) to tell it not to buffer, or by calling sys.stdout.flush() throughout your script any time you want it to make sure that the output has made it to P4V.

See also:

http://kb.perforce.com/article/914/sending-script-output-to-p4vs-custom-tool-terminal

(It looks like that question was asked and answered after you asked here on Stack Overflow. Sorry if you're already well aware of it.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文