On Tue, 2005-08-23 at 16:58 +0800, Jeff Pitman wrote:
On Tuesday 23 August 2005 16:44, Warren Togami wrote:
> UnboundLocalError: local variable 'retval' referenced before
> assignment Cleaning up the buildroot...
> /usr/bin/setarch ppc32 /usr/bin/mock clean
Somehow if os.WIFEXITED(status): resulted in FALSE. So, retval
was never assigned. Currently, the do() function does not pre-init
retval prior to the "if" with a default value.
Something like this is needed:
def do(self, command):
"""execute given command outside of chroot"""
self.debug("Executing %s" % command)
(status, output) = commands.getstatusoutput(command)
retval = 0
if os.WIFEXITED(status):
retval = os.WEXITSTATUS(status)
return (retval, output)
thanks, applied - though its worth noting that people should only ever
encounter this when their hardware is failing. :)
-sv