Re: [computer-go] GoGui and python
Thanks to all who replied. This fixed my problem. THN On Fri, 24 Aug 2007, Adrian Petrescu wrote: Yeah, flushing stdout should be all you need to do to make this work. To do this, import sys sys.stdout.flush() Good luck :) ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
[computer-go] GoGui and python
Has anyone here tried using GoGui with python? I thought the print statement would send commands well enough, but it doesn't seem to. Here's some very simple code: command = raw_input() print = myName\n Obviously, this is a toy example, but GoGui responds with the program never responded to the name command. If I write out to a file, I can see my response just fine. Has anyone here used GoGui before? Is there a better gtp gui to use? The only example I've found anywhere is a Delphi example using some Windows primatives. I'd like to avoid that if I can. Thanks for you time. THN ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
Re: [computer-go] GoGui and python
command = raw_input() print = myName\n Obviously, this is a toy example, but GoGui responds with the program never responded to the name command. If I write out to a file, I can see my response just fine. Have you tried flushing stdout after print? (or setting up stdout to not buffer?). A quick google confirmed python is buffering stdout, but I couldn't find the flush command. Darren -- Darren Cook http://dcook.org/mlsn/ (English-Japanese-German-Chinese free dictionary) http://dcook.org/work/ (About me and my work) http://dcook.org/work/charts/ (My flash charting demos) ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
Re: [computer-go] GoGui and python
Yeah, flushing stdout should be all you need to do to make this work. To do this, import sys sys.stdout.flush() Good luck :) On 8/24/07, Darren Cook [EMAIL PROTECTED] wrote: command = raw_input() print = myName\n Obviously, this is a toy example, but GoGui responds with the program never responded to the name command. If I write out to a file, I can see my response just fine. Have you tried flushing stdout after print? (or setting up stdout to not buffer?). A quick google confirmed python is buffering stdout, but I couldn't find the flush command. Darren -- Darren Cook http://dcook.org/mlsn/ (English-Japanese-German-Chinese free dictionary) http://dcook.org/work/ (About me and my work) http://dcook.org/work/charts/ (My flash charting demos) ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/ ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
Re: [computer-go] GoGui and python
Thomas, On Fri, 2007-08-24 at 17:26 -0500, Thomas Nelson wrote: command = raw_input() print = myName\n the following is taken directly from the protocol specification: - 2.6 Response Structure If successful, the engine returns a response of the form =[id] result Here '=' indicates success, id is the identity number given in the command, and result is a piece of text ending with two consecutive newlines. - Please note the two consecutive newlines. As others have already pointed out, you have to flush the output if it is buffered. Hellwig ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
Re: [computer-go] GoGui and python
He has two consecutive newlines since print adds one unless the print statement has a comma at the end. - George On 8/24/07, Hellwig Geisse [EMAIL PROTECTED] wrote: Thomas, On Fri, 2007-08-24 at 17:26 -0500, Thomas Nelson wrote: command = raw_input() print = myName\n the following is taken directly from the protocol specification: - 2.6 Response Structure If successful, the engine returns a response of the form =[id] result Here '=' indicates success, id is the identity number given in the command, and result is a piece of text ending with two consecutive newlines. - Please note the two consecutive newlines. As others have already pointed out, you have to flush the output if it is buffered. Hellwig ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/ ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/
Re: [computer-go] GoGui and python
On Fri, 2007-08-24 at 19:11 -0400, George Dahl wrote: He has two consecutive newlines since print adds one unless the print statement has a comma at the end. - George Ah, thanks, didn't know that. I suspected this to be the error because the two newlines in responses are in my experience the most overlooked detail in the GTP spec. Hellwig ___ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/