开发者

How to output in the log window in perforce client p4v using custom tools

开发者 https://www.devze.com 2022-12-26 12:52 出处:网络
We\'re developing perforce custom tools in pyt开发者_如何学Pythonhon and we\'re outputting messages during the script execution. It shows up in p4win but we\'re mainly using p4v and the output doesn\'

We're developing perforce custom tools in pyt开发者_如何学Pythonhon 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?


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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消