[elbe-devel] [PATCH v2] kvm: avoid unboundlocalerror

Manuel Traut manut at linutronix.de
Mon Jul 23 14:24:42 CEST 2018


/usr/bin/kvm: 2: exec: qemu-system-x86_64: not found
Traceback (most recent call last):
  File "./elbe", line 52, in <module>
    mod = __import__(modname)
  File "/home/elbe/elbepack/commands/initvm.py", line 13, in <module>
    from elbepack.initvmaction import InitVMAction, InitVMError
  File "/home/elbe/elbepack/initvmaction.py", line 18, in <module>
    from elbepack.elbexml import ElbeXML, ValidationError, ValidationMode
  File "/home/elbe/elbepack/elbexml.py", line 13, in <module>
    from elbepack.xmldefaults import ElbeDefaults
  File "/home/elbe/elbepack/xmldefaults.py", line 123, in <module>
    "interpreter": find_kvm_exe()[0],
  File "/home/elbe/elbepack/kvm.py", line 34, in find_kvm_exe
    return fname, version
UnboundLocalError: local variable 'version' referenced before assignment
WARNING: exit code 1 from a shell command.
DEBUG: Python function do_compile finished

Signed-off-by: Manuel Traut <manut at linutronix.de>
---

changes since v1:

 * init version with '0.0.0' instead of empty string

 elbepack/kvm.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/elbepack/kvm.py b/elbepack/kvm.py
index 2b67d5c5..62f2ddeb 100644
--- a/elbepack/kvm.py
+++ b/elbepack/kvm.py
@@ -17,6 +17,7 @@ kvm_exe_list = [
 
 
 def find_kvm_exe():
+    version = "0.0.0"
     for fname in kvm_exe_list:
         if os.path.isfile(fname) and os.access(fname, os.X_OK):
             # determine kvm version
-- 
2.18.0




More information about the elbe-devel mailing list