Local variable 'percent' referenced before assignment error.

Bug #1943335 reported by Cubic PPA
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cubic
Fix Released
Low
Cubic PPA

Bug Description

There is a very rare situation when a process finishes immediately, and the EOF (indicating that the process completed) occurs before any percentage output is generated by the process.

exception in thread Thread-38:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/cubic/cubic/navigator.py", line 566, in navigate
    result = new_page.enter(action, page) if new_page else None
  File "/usr/share/cubic/cubic/pages/generate_page.py", line 200, in enter
    is_error = create_iso_image()
  File "/usr/share/cubic/cubic/pages/generate_page.py", line 943, in create_iso_image
    exception, message = show_progress(command, progress_callback, working_directory=model.project.custom_disk_directory)
  File "/usr/share/cubic/cubic/utilities/progressor.py", line 312, in show_progress
    exception, message = process_command(command, progress_tracker, working_directory)
  File "/usr/share/cubic/cubic/utilities/progressor.py", line 274, in process_command
    if percent < FINAL_PERCENT:
UnboundLocalError: local variable 'percent' referenced before assignment
  • Clicked................................ Back

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

In this case, we need to increment the final percent from zero to 100%. However, the percent variable is not assigned, and this results in the following error:

UnboundLocalError: local variable 'percent' referenced before assignment

The solution is to initialize the percent variable before we begin executing the process.

Changed in cubic:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → Cubic PPA (cubic-wizard)
status: Confirmed → In Progress
Cubic PPA (cubic-wizard)
Changed in cubic:
status: In Progress → Fix Committed
Revision history for this message
Cubic PPA (cubic-wizard) wrote (last edit ):

Fix released in Cubic version 2021.09-53.

Changed in cubic:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.