Why is error message value "disappearing"?
no_replies at fake_email_address.invalid
Tue Jun 10 00:23:35 CEST 2003
I have code that acts as the following (stripped down for purposes of
# errlost.py ------------------------
errMsg = "no error."
valid_call = 0
fldname = "test"
# do something that raises a LookupError exception.
except LookupError, e:
errMsg = "Warning, lookup error occurred accessing field name <%s>"
print "In errtest, errMsg = ", errMsg
# END: errtest
# test errtest()
errMsg = ""
if not errtest(errMsg):
print "Outside errtest, errMsg = ", errMsg
When I run the code I get the following printout:
In errtest, errMsg = "Warning, lookup error occurred accessing field
Outside errtest, errMsg = ""
It's as if errMsg is being passed by value and the assignment that occurs
inside errtest() doesn't "stick". I thought Python was pass by reference?
What am I doing wrong?
Android Technologies, Inc.
- The home of Off-Book! (tm)
The scene memorization tool for Actors and Actresses!
More information about the Python-list