From: Discussions c. R. <rea...@li...> - 2007-01-16 21:55:12
|
Hi Phillipe, Did you flush your stdout when having sent your first lines?=20 Regards Johannes -----Original Message----- From: rea...@li... = [mailto:rea...@li...] On = Behalf Of Discussions concerning RealTimeBattle Sent: Dienstag, 16. 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***** #************************************************************************= ****** #************************************************************************= ****** #************************************************************************= ****** #************************************************************************= ****** 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***** #************************************************************************= ****** #************************************************************************= ****** #************************************************************************= ****** #************************************************************************= ****** class PyRobot: [....] = #************************************************************************= ** def __init__(self,p_name,p_home_colour,p_away_colour):=09 self.m_q =3D Queue()=09 signal.signal(signal.SIGUSR1, self.Signal) =09 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 """" =09 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=20 > 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=20 > by the way > 3) I cannot use select as Python only support select on stdin on *nix=20 > 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 is=20 > still handled by rtb as debugging messages do not appear anymore on=20 > the message window .... yet my process is still running as I also log=20 > 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"=20 > 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 need=20 > the source let me know. > > Regards, > > Philippe -- _________________________ 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 |