Skip to content
This repository was archived by the owner on Nov 1, 2026. It is now read-only.
This repository was archived by the owner on Nov 1, 2026. It is now read-only.

UnboundLocalError after an error dialog in Search, Taxon and Translate (FASTA) #13

Open

Description

@dpc00

Claude reports: several error paths run on after the except block and then use a variable that was never assigned, so the command ends with UnboundLocalError (and in some cases the user sees no message at all). Reproduced by making the Entrez call raise IOError for one run (a simulated network failure), and for Translate with an invalid codon:

  • Get Sequences by Search, line 70: ids after a failed Entrez.esearch (lines 61-68). No dialog is shown, only the traceback in the console.
  • Get Sequences by Taxon, line 222: links after a failed Entrez.elink (the dialog at line 219 is shown, then the traceback).
  • Get Sequences by Taxon, line 246: handle after a failed Entrez.efetch (dialog, then traceback).
  • Translate, FASTA branch, line 288: aa_seq after translate() fails (selection >x + ATG@CCGGG gives the dialog Codon '@CC' is invalid, then UnboundLocalError: cannot access local variable 'aa_seq'). The plain-text branch has the same problem (Translate: RNA input passes validation, then fails with UnboundLocalError #7).

Fix: return (or continue) after each error dialog, so nothing runs on with a missing value.

Tested on Sublime Text build 4215 (portable, Windows), plugin host Python 3.14, installed through Package Control (BioPythonUtils 2017.12.18.15.00.45, which contains the fixes for #3). Line numbers are those of BioPythonUtils.py on master (de058c4).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions