From: Discussions c. R. <rea...@li...> - 2007-01-17 13:38:05
|
Every endl prints a newline and flushes stdout. Regards Johannes=20 -----Original Message----- From: rea...@li... = [mailto:rea...@li...] On = Behalf Of Discussions concerning RealTimeBattle Sent: Dienstag, 16. Januar 2007 16:03 To: rea...@li... Subject: Re: [Realtimebattle-discussion] Signal and Python Hi Johannes, You're a wiz - many thanks, I can go on to my next bug now :-) PS: from the c++ source I see out there, does that mean that cout = flushes automatically ? Regards, Philippe On Tuesday 16 January 2007 22:55, Discussions concerning RealTimeBattle = wrote: > Hi Phillipe, > > Did you flush your stdout when having sent your first lines? > > Regards > > Johannes > > -----Original Message----- > From: rea...@li... > [mailto:rea...@li...] On=20 > Behalf Of Discussions concerning RealTimeBattle Sent: Dienstag, 16.=20 > Januar 2007 > 15:39 > To: rea...@li... > Cc: Discussions concerning RealTimeBattle > Subject: Re: [Realtimebattle-discussion] Signal and Python > > Hi Joannes, > > I am testing under linux. > > As I could not (do not know how to) pass stdin from a .sh to my .py, I = > do not have any shell wrapper but have rtb point directly to my = "snake.robot" > which is a python executable. > > Regards, > > Philippe > > > > > > snip code: > > **** main / robot class***** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** class Snake(PyRobot): > def __init__(self, p_name,p_home_colour,p_away_colour): > """ > call PyRobot constructor > """ > PyRobot.__init__(self, p_name,p_home_colour,p_away_colour) > > def Run(self) > """ > main loop > """ > [.....] > > > #**************************************************************** > if __name__ =3D=3D '__main__': > l_robot =3D Snake('Snake', 0xee299, 0xaaffaa) > l_robot.Run('RUNNING') > > **** PyRobot framework***** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** >=20 >#********************************************************************** >**** >**** class PyRobot: > [....] > =09 >#********************************************************************** >*** >* def __init__(self,p_name,p_home_colour,p_away_colour): > self.m_q =3D Queue() > signal.signal(signal.SIGUSR1, self.Signal) > > > self.RobotOption(PyRobot.R_OPT_USE_NON_BLOCKING, 0) > self.RobotOption(PyRobot.R_OPT_SIGNAL, signal.SIGUSR1) > > =09 >#********************************************************************** >*** >* def Signal(self, p_sig, p_frame): > """" > this is where I get info from stdin > """" > > On Monday 15 January 2007 22:13, Discussions concerning RealTimeBattle wrote: > > Hi Phillipe, > > > > first of all, do you test your robot under Windows or under Linux? > > Do you use a wrapper script to call your python script? > > > > Regards > > > > Johannes > > > > -----Urspr=FCngliche Nachricht----- > > Von: rea...@li... im=20 > > Auftrag von Discussions concerning RealTimeBattle Gesendet: Mo > > 15.01.2007 14:13 > > An: rea...@li... > > Betreff: [Realtimebattle-discussion] Signal and Python > > > > Hi, > > > > I am very new to realtimebattle and have a question regarding the=20 > > signal management. > > > > 1) I want to write a high-level interface to realtimebattle in = Python ... > > as my first goal is to use it as a teaching tool for my kids. > > 2) I do not want to use blocking reads (raw_input) ... which do work = > > by the way > > 3) I cannot use select as Python only support select on stdin on=20 > > *nix and not windows > > 4) So I want to use signals to get messages > > > > > > Well, I am not getting my signal ... and am not certain my process=20 > > is still handled by rtb as debugging messages do not appear anymore=20 > > on the message window .... yet my process is still running as I also = > > log into a text file and that I see I'm still alive. > > > > yet if I end rtb, it does kill my process > > > > Also I know I trap the signal correctly as doing a "kill -10 PID" > > under *nix shows in my log file. > > > > These are the commands I first send to rtb: > > RobotOption 3 1 > > RobotOption 2 10 > > Name Snake > > Colour ee299 ee299 > > > > > > And I notice that the name is not set in rtb ... and that if I wait=20 > > for a signal before I "Name Snake" ... then I don't even get there. > > > > > > Clearly something I misread ... any help much welcome ... if you=20 > > need the source let me know. > > > > Regards, > > > > Philippe > > -- > _________________________ > Philippe C. Martin > www.snakecard.com > _________________________ > > > ---------------------------------------------------------------------- > --- Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to share=20 > your opinions on IT & business topics through brief surveys - and earn = > cash=20 > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEV > DEV _______________________________________________ > Realtimebattle-discussion mailing list=20 > Rea...@li... > https://lists.sourceforge.net/lists/listinfo/realtimebattle-discussion > > ---------------------------------------------------------------------- > --- Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to share=20 > your opinions on IT & business topics through brief surveys - and earn = > cash=20 > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEV > DEV _______________________________________________ > Realtimebattle-discussion mailing list=20 > Rea...@li... > https://lists.sourceforge.net/lists/listinfo/realtimebattle-discussion -- _________________________ Philippe C. Martin www.snakecard.com _________________________ -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share = your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ Realtimebattle-discussion mailing list Rea...@li... https://lists.sourceforge.net/lists/listinfo/realtimebattle-discussion |