Local variable 'percent' referenced before assignment error.
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/
self.run()
File "/usr/lib/
self.
File "/usr/share/
result = new_page.
File "/usr/share/
is_error = create_iso_image()
File "/usr/share/
exception, message = show_progress(
File "/usr/share/
exception, message = process_
File "/usr/share/
if percent < FINAL_PERCENT:
UnboundLocalError: local variable 'percent' referenced before assignment
• Clicked.
Changed in cubic: | |
status: | In Progress → Fix Committed |
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.