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" 3 1573
HMS Surprise wrote:
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"
The except: block still needs something in it, even if it is just "pass".
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
On May 16, 4:22 pm, Robert Kern <robert.k...@gmail.comwrote:
HMS Surprise wrote:
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"
The except: block still needs something in it, even if it is just "pass".
For sake of demonstration:
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:
pass
else:
print "couldn't find incident"
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
On May 17, 7:51 am, Dustan <DustanGro...@gmail.comwrote:
On May 16, 4:22 pm, Robert Kern <robert.k...@gmail.comwrote:
HMS Surprise wrote:
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"
The except: block still needs something in it, even if it is just "pass".
For sake of demonstration:
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:
pass
else:
print "couldn't find incident"
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Thanks folks. Found my error but I didn't know of pass option.....
Wanted to get back in earlier and state I found the error but Google
groups seemed to be down for half a day....
jvh This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: William C. White |
last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using
cURL? Our website is hosted on a shared drive and the webhost company
doesn't installed additional software (such as cURL)...
|
by: Albert Ahtenberg |
last post by:
Hello,
I don't know if it is only me but I was sure that header("Location:url")
redirects the browser instantly to URL, or at least stops the execution of
the code. But appearantely it continues...
|
by: James |
last post by:
Hi,
I have a form with 2 fields.
'A'
'B'
The user completes one of the fields and the form is submitted.
On the results page I want to run a query, but this will change
subject to which...
|
by: Ollivier Robert |
last post by:
Hello,
I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9
system. The link succeeds but everytime I try to run php, I get a SEGV from
inside the libcnltsh.so library.
...
|
by: Richard Galli |
last post by:
I want viewers to compare state laws on a single subject.
Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the...
|
by: Albert Ahtenberg |
last post by:
Hello,
I have two questions.
1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?
2. When the...
|
by: inderjit S Gabrie |
last post by:
Hi all
Here is the scenerio ...is it possibly to do this...
i am getting valid course dates output on to a web which i have designed
....all is okay so far , look at the following web url
...
|
by: Jack |
last post by:
Hi All,
What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g.
select x from y where z=:parameter
Which in asp/jsp would be followed by some statements to bind a value...
|
by: Sandwick |
last post by:
I am trying to change the size of a drawing so they are all 3x3.
the script below is what i was trying to use to cut it in half ... I
get errors.
I can display the normal picture but not the...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
| |