Add a New Comment (Rich Markup)
The folowing python function is available in the just released 1.07 version : Add a gnubg.show() python function to return the result of a "show" command(minus the final(s) \n) as a string. The result is "as is", subject to i18n. The caller has to parse it if needed. Doing this for "command" does not seem reasonable since its output is potentially illimited.
There is no obvious way to get what is printed by gnubg.command() in a python variable. gnubg.command is really a kind of minimal catch-all to run whatever CLI command that has not equivalent in the python API. It would make sense for it to do this, or to have a gnubg.show() function retunrning a string, but neither is currently available. What you could do is to start with gnubg.board() and compute the pip counts, percentage difference and cube decision according to the 8/9/12 rule yourself.
Hi I'm trying to create a GNUbg Python script that takes the 8912 theory output of a specific move and then add to the comments section of that move. The reason I need it in the comments is that I am trying to make the 8912 output show on the HTML export as an Annotation. I have tried the following code: s = gnubg.command('show 8912') gnubg.command('annotate move comment "' + s + '"') But it does not work because gnubg.command does not return anything. The output is written to the screen. I tried to capture stdout using regular Python stdout code, but it didn't work, so I assume because the script is running inside gnubg itself? I am launching the script using 'load python script_name.py' at the gnubg command prompt. Any help would be appreciated on how to capture output from gnubg.command(). Thank you. MBR
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 4 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12