Re: Help catching error message

2011-11-08 Thread Steven D'Aprano
On Tue, 08 Nov 2011 17:48:57 -0800, Gnarlodious wrote: > On Nov 8, 3:16 pm, Steven D'Aprano wrote: > >> content = Data.Dict.SaveEvents(Data.Plist.Events) or content >> >> This will leave content unchanged if no error is returned, otherwise it >> will replace the value. > Ah, the 'or' operator doe

Re: Help catching error message

2011-11-08 Thread Gnarlodious
On Nov 8, 3:16 pm, Steven D'Aprano wrote: > content = Data.Dict.SaveEvents(Data.Plist.Events) or content > > This will leave content unchanged if no error is returned, otherwise it > will replace the value. Ah, the 'or' operator does it. Thank you, that is exactly what I was looking for. I should

Re: Help catching error message

2011-11-08 Thread Steven D'Aprano
On Tue, 08 Nov 2011 05:20:51 -0800, Gnarlodious wrote: > What I say is this: > > def SaveEvents(self,events): >try: > plistlib.writePlist(events, self.path+'/Data/Events.plist') # > None if OK >except IOError: > return "IOError: [Errno 13] Apache can't write Events.plist > fil

Re: Help catching error message

2011-11-08 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Gnarlodious wrote: What I say is this: def SaveEvents(self,events): try: plistlib.writePlist(events, self.path+'/Data/Events.plist') # None if OK except IOError: return "IOError: [Errno 13] Apache can't write Events.plist file" Note that success r

Re: Help catching error message

2011-11-08 Thread Jean-Michel Pichavant
Gnarlodious wrote: What I say is this: def SaveEvents(self,events): try: plistlib.writePlist(events, self.path+'/Data/Events.plist') # None if OK except IOError: return "IOError: [Errno 13] Apache can't write Events.plist file" Note that success returns"None" while failure ret

Help catching error message

2011-11-08 Thread Gnarlodious
What I say is this: def SaveEvents(self,events): try: plistlib.writePlist(events, self.path+'/Data/Events.plist') # None if OK except IOError: return "IOError: [Errno 13] Apache can't write Events.plist file" Note that success returns"None" while failure returns a string. I cat