Thanks Susanne. If I initialise the variable before calling GetData(), and then test using
if self.file: it seems to work OK. I now have another problem - the data does not get deleted from the application service when all copies of the application are terminated. The very first time the application is started, it reports there is no data stored, as it should. However if I terminate the application and then restart it, it reports that there is existing data. The only way to delete the data appears to be to delete the shared app from the venue client window, and then add the shared app again (using the Start Application Session option under the Venue menu in the venue client window). Is this normal behaviour, or do I have to somehow manually delete the data when the application terminates? cheers steve Susanne Lefvert wrote: > This works for me: > > ----------------------- > self.file = None > > # Get current state > self.file = self.sharedAppClient.GetData("file") > > if self.file: > # do stuff > else: > print "data does not exist..." > ------------------------ > > Which platform? > > Susanne > > > On Wed, 13 Apr 2005, Stephen Jeffrey wrote: > > >>Hi All, >> >>I am writing a shared application using wxPython. The application >>is to query if there is any shared data present when it starts. >>ie. if another copy of the application is already running and has >>sent some data using sharedAppClient.SetData(), when the second >>copy of the application starts it should obtain the data stored >>by the first copy. >> >>How can I query if there is any shared data already present? >>I have tried: >> >>d = self.sharedAppClient.GetData("data") >>if len(d) > 0: >> >>and other variations such as: >> >>d = self.sharedAppClient.GetData("data") >>if d != 0: >> >>and >> >>d = self.sharedAppClient.GetData("data") >>if d != None: >> >>but it appears as though GetData() is returning junk - when the >>first copy of the application starts there should not be >>any shared data present, but it returns non-zero data. >> >>Is there some way to overcome this, or do I have to somehow >>get the first instance of the application to "initialise" >>the shared data. >> >>cheers >>steve >> >>-- >>Dr Stephen Jeffrey >>Advanced Computational Modelling Centre >>University of Queensland >>St. Lucia Queensland 4072 Australia >> >>Phone: +61 (7) 3365 6130 >>Fax: +61 (7) 3365 6136 >>Email: s...@maths.uq.edu.au >>Web: http://www.acmc.uq.edu.au >> >>