[arch-general] Could python2 be breaking genpkgmetadata.py?
Guys, I'm using yum-createrepo 0.9.8-3 on from AUR and suddenly my createrepo updates on my Arch server are failing with the following error: 23:22 nirvana:/home/backup/rpms> sudo createrepo --update -d openSUSE_11.3/ File "/usr/share/createrepo/genpkgmetadata.py", line 189 print thing ^ SyntaxError: invalid syntax Nothing with createrepo has changed, could this be a python/python2 bug? I have both the following installed: python 3.1.2-2 python2 2.7-3 Should I have both installed? I've also posted to the rpm-metadata list to see if they have identified an issue with the genpkgmetadata.py script. The relevant lines in the python script are: class MDCallBack(object): """cli callback object for createrepo""" def errorlog(self, thing): """error log output""" print >> sys.stderr, thing def log(self, thing): """log output""" print thing def progress(self, item, current, total): """progress bar""" beg = "%*d/%d - " % (len(str(total)), current, total) left = 80 - len(beg) sys.stdout.write("\r%s%-*.*s" % (beg, left, left, item)) sys.stdout.flush() Which since I don't know python -- it might as well be Greek. But from the error, I can tell it chokes on the line "print thing"... whatever that thing is. Anybody have any info on any problems caused by recent python changes? -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
On 12 November 2010 13:32, David C. Rankin <drankinatty@suddenlinkmail.com> wrote:
Guys,
I'm using yum-createrepo 0.9.8-3 on from AUR and suddenly my createrepo updates on my Arch server are failing with the following error:
23:22 nirvana:/home/backup/rpms> sudo createrepo --update -d openSUSE_11.3/ File "/usr/share/createrepo/genpkgmetadata.py", line 189 print thing ^ SyntaxError: invalid syntax
Not bug, change. Print is now a function in Python 3, i.e. one has to use print(thing) instead of the previous form. http://docs.python.org/release/3.0.1/whatsnew/3.0.html Most likely either change the call in beginning of the script to python2 instead of python, or roll up the sleeves and start converting to the new version (python 2to3 should help http://docs.python.org/library/2to3.html ) Cheers, Greg
On Fri, 2010-11-12 at 13:46 +0800, Gergely Imreh wrote:
On 12 November 2010 13:32, David C. Rankin <drankinatty@suddenlinkmail.com> wrote:
Guys,
I'm using yum-createrepo 0.9.8-3 on from AUR and suddenly my createrepo updates on my Arch server are failing with the following error:
23:22 nirvana:/home/backup/rpms> sudo createrepo --update -d openSUSE_11.3/ File "/usr/share/createrepo/genpkgmetadata.py", line 189 print thing ^ SyntaxError: invalid syntax
Not bug, change. Print is now a function in Python 3, i.e. one has to use print(thing) instead of the previous form. http://docs.python.org/release/3.0.1/whatsnew/3.0.html
Most likely either change the call in beginning of the script to python2 instead of python, or roll up the sleeves and start converting to the new version (python 2to3 should help http://docs.python.org/library/2to3.html )
Cheers, Greg
Out of curiosity, David, I know you're on the ML quite often, how could you NOT realize all the python update emails and complaints going around?
On 11/12/2010 12:47 AM, Ng Oon-Ee wrote:
Out of curiosity, David, I know you're on the ML quite often, how could you NOT realize all the python update emails and complaints going around?
Err.. (sheepishly) -- python to me is a snake. So while I did see the emails about the python issues, etc.. -- they didn't register any alarm bells until the snake turned around and bit me :p So what's the consensus, change all the #!/usr/bin/python to #!/usr/bin/python2 in the scripts giving errors? I know nobody wants me hacking the scripts to try and move them to python 3 (especially me...) Currently the guys on the createrepo list (rpm-metadata) haven't even ported createrepo to python 3, so I guess the fix would be to fix the executable line. But on how many packages? Just the ones that are breaking or is there some set of base packages I should backup and the do a 'perl -p -i -e s/bin\/python/bin\/python2/' on? I should learn more python, but there are only so many hours in the day, and I can usually do what I need in BASH, c or perl anyway :) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
On 11/12/2010 11:44 AM, David C. Rankin wrote:
But on how many packages? Just the ones that are breaking or is there some set of base packages I should backup and the do a 'perl -p -i -e s/bin\/python/bin\/python2/' on?
Err.. It doesn't seem to be that simple. After changed the executable line, now the scripts don't find the modules: Traceback (most recent call last): File "/usr/share/createrepo/genpkgmetadata.py", line 29, in <module> import createrepo ImportError: No module named createrepo Is there a way to teach the python2 scripts about the modules it used to know? -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
participants (3)
-
David C. Rankin
-
Gergely Imreh
-
Ng Oon-Ee