Bug 854979 - Python-2.4 incompatible syntax
Summary: Python-2.4 incompatible syntax
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-bugzilla
Version: el5
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Will Woods
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-09-06 12:39 UTC by Vitaly Kuznetsov
Modified: 2013-01-10 06:54 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-11-28 14:58:35 UTC

Attachments (Terms of Use)
Updated python-bugzilla-2.4-backcompat.patch (1.47 KB, patch)
2012-09-06 14:42 UTC, Toshio Ernie Kuratomi
no flags Details | Diff

Description Vitaly Kuznetsov 2012-09-06 12:39:46 UTC
Description of problem:
python-bugzilla in EPEL5 has python2.4-incompatible syntax:
Traceback (most recent call last):
  File "/usr/bin/bugzilla", line 17, in ?
    import bugzilla.util
  File "/usr/lib/python2.4/site-packages/bugzilla/util.py", line 31
    except OSError as e:

Here is 1-line fix:
 perl -pi -e "s/except (.*) as (.*):/except \$1, \$2:/g" /usr/lib/python2.4/site-packages/bugzilla/util.py

# rpm -q python-bugzilla

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Install python-bugzilla
2.run bugzilla
Actual results:
# bugzilla 
Traceback (most recent call last):
  File "/usr/bin/bugzilla", line 17, in ?
    import bugzilla.util
  File "/usr/lib/python2.4/site-packages/bugzilla/util.py", line 31
    except OSError as e:

Expected results:
# bugzilla 
usage: bugzilla [global options] COMMAND [command-options]
Commands: login, new, query, modify, attach, info

bugzilla: error: command must be one of: login,new,query,modify,attach,info

Additional info:

Comment 1 Toshio Ernie Kuratomi 2012-09-06 14:42:51 UTC
Created attachment 610371 [details]
Updated python-bugzilla-2.4-backcompat.patch

Here's the python-bugzilla 2.4 backcompat patch updated to fix the exception syntax.  The changed portion is this addition:

Index: python-bugzilla-0.7.0/bugzilla/util.py
--- python-bugzilla-0.7.0.orig/bugzilla/util.py
+++ python-bugzilla-0.7.0/bugzilla/util.py
@@ -28,7 +28,7 @@ def open_without_clobber(name, *args):
     while fd is None:
             fd = os.open(name, os.O_CREAT|os.O_EXCL, 0666)
-        except OSError as e:
+        except OSError, e:
             if e.errno == os.errno.EEXIST:
                 name = "%s.%i" % (orig_name, count)
                 count += 1

I checked that there are presently no other places that use the as syntax.

If we're preparing (in upstream) for python3, we probably want to switch all exception handling to the as syntax and the difference will become greater.  (Perhaps we'd be able to use 3to2 on that, though)....

Comment 2 Fedora Update System 2012-10-18 22:04:22 UTC
python-bugzilla-0.7.0-2.el5 has been submitted as an update for Fedora EPEL 5.

Comment 3 Cole Robinson 2012-10-18 22:04:50 UTC
Thanks Toshio, I used your fix.

Comment 4 Fedora Update System 2012-10-19 13:06:51 UTC
Package python-bugzilla-0.7.0-2.el5:
* should fix your issue,
* was pushed to the Fedora EPEL 5 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing python-bugzilla-0.7.0-2.el5'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 5 Cole Robinson 2012-11-28 14:58:35 UTC
Package hit stable

Note You need to log in before you can comment on or make changes to this bug.