try

HMS Surprise john at datavoiceint.com
Wed May 16 17:18:11 EDT 2007


I read in the ref man that try-except-finally did not work in earlier
versions, I am using jython 2.2. Does this imply that try-except
without finally does not work either? I get a syntax error on the else
below. Some of the functions embedded in the try section try to
convert strings to ints, etc and may fail on bad data, thus try seemed
like a good start for a workaround.

Thanks,

jh


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def restoreDevice(self, deviceId, closeTime = time()):
	self.logon()
	try:
	    lst = self.getLastUpdatedDevice(deviceId)
	    lastUpdated = lst[0]
	    incidentId = lst[1]
	    print 'L', lastUpdated, 'I', incidentId
	    self.restore(incidentId, lastUpdated)
	except:
	else:
	    print "couldn't find incident"




More information about the Python-list mailing list