UnboundLocalError: local variable 'setEstablished' referenced before assignment

Bug #1849454 reported by Bastiaan Stougie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
orca (Ubuntu)
Fix Released
High
Unassigned

Bug Description

$ lsb_release -rd
Description: Ubuntu 19.10
Release: 19.10

$ apt-cache policy orca
orca:
  Installed: 3.34.0-1ubuntu3
  Candidate: 3.34.0-1ubuntu3
  Version table:
 *** 3.34.0-1ubuntu3 500
        500 http://be.archive.ubuntu.com/ubuntu eoan/main amd64 Packages
        500 http://be.archive.ubuntu.com/ubuntu eoan/main i386 Packages
        100 /var/lib/dpkg/status

When I run orca --setup, in the "Voice" tab, I change only the "Speech synthesizer" setting and click "Apply" or "OK", the settings should be saved. Instead I get an error:

$ orca --setup
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/orca/orca_gui_prefs.py", line 3261, in applyButtonClicked
    self.writeUserPreferences()
  File "/usr/lib/python3/dist-packages/orca/orca_gui_prefs.py", line 394, in writeUserPreferences
    keyBindingsDict)
  File "/usr/lib/python3/dist-packages/orca/settings_manager.py", line 488, in saveSettings
    self.profileKeybindings)
  File "/usr/lib/python3/dist-packages/orca/backends/gsettings_backend.py", line 232, in saveProfileSettings
    self._saveVoiceSettings(general['voices'], profile)
  File "/usr/lib/python3/dist-packages/orca/backends/gsettings_backend.py", line 615, in _saveVoiceSettings
    elif appSpecific == False and setEstablished == True:
UnboundLocalError: local variable 'setEstablished' referenced before assignment

Revision history for this message
Bastiaan Stougie (ghengiz-cohen) wrote :

I traced the problem to /usr/lib/python3/dist-packages/orca/backends/gsettings_backend.py. Variable setEstablished is not initialized:

    def _saveVoiceSettings(self, voiceSettings, profile, app=None):
        if app is not None and app != '':
            appSpecific = True
        else:
            appSpecific = False

        for voice in ['default', 'uppercase', 'hyperlink', 'system']:
            if appSpecific == True:

I think it should be initialized as follows:

    def _saveVoiceSettings(self, voiceSettings, profile, app=None):
        if app is not None and app != '':
            appSpecific = True
        else:
            appSpecific = False

        for voice in ['default', 'uppercase', 'hyperlink', 'system']:
            setEstablished = False
            if appSpecific == True:

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for the bug report and the debugging. The backend was not maintained and buggy so it was removed in the recent upload, which fixes the issue https://launchpad.net/ubuntu/+source/orca/3.35.3-1ubuntu1
Would still be useful to do a stable update with the fix though

Changed in orca (Ubuntu):
importance: Undecided → High
status: New → 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.