[Biopython-dev] [Bug 2882] New: Unnamed variable used to raise Exception in /Bio/SwissProt/__init__.py

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Jul 21 15:21:35 UTC 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2882

           Summary: Unnamed variable used to raise Exception in
                    /Bio/SwissProt/__init__.py
           Product: Biopython
           Version: 1.51b
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: sjcockell at gmail.com


When raising a ValueError on finding an unknown key in a SwissProt record,
Bio.SwissProt.__init__._read() references the undefined 'keyword' instead of
the expected 'key'. 
Instead of raising a ValueError, a NameError is raised:
Traceback (most recent call last):
  File "goClass.py", line 31, in <module>
    main('tubulin')
  File "goClass.py", line 23, in main
    record = SwissProt.read(handle)
  File
"[...]/biopython-1.51b/build/lib.macosx-10.5-i386-2.5/Bio/SwissProt/__init__.py",
line 120, in read
    record = _read(handle)
  File
"[...]/biopython-1.51b/build/lib.macosx-10.5-i386-2.5/Bio/SwissProt/__init__.py",
line 236, in _read
    raise ValueError("Unknown keyword %s found" % keyword)
NameError: global name 'keyword' is not defined

Fixed by the following patch file:
"
240c240
<             raise ValueError("Unknown keyword %s found" % keyword)
---
>             raise ValueError("Unknown keyword %s found" % key)
"

Regards
Simon
--
http://fuzzierlogic.com
http://friendfeed.com/sjcockell
http://twitter.com/sjcockell


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list