+ -
当前位置:首页 → 问答吧 → python2.4代码迁移到2.7报错求助,self.repos.populateSack(with='filelists')

python2.4代码迁移到2.7报错求助,self.repos.populateSack(with='filelists')

时间:2011-07-02

来源:互联网

本人完全所python小白,但是现在项目需要迁移。过程中出错。出错提示如下。请教各位。望帮忙。。
  1. Traceback (most recent call last):
  2.   File "~/host/bin/stmyum", line 9, in <module>
  3.     import yummain
  4.   File "~/host/usr/share/yum-cli/yummain.py", line 22, in <module>
  5.     from yum import Errors
  6.   File "~/host/usr/lib/python2.3/site-packages/yum/__init__.py", line 399
  7.     self.repos.populateSack(with='filelists')
  8.                                ^
  9. SyntaxError: invalid syntax
复制代码
此问题该如何解决。。

作者: ddd010   发布时间: 2011-07-02

晕死,自己把with 该为mdtype就可以了。。

作者: ddd010   发布时间: 2011-07-02

回复 ddd010
with 2.7里是关键字。

作者: 106033177   发布时间: 2011-07-02

回复 106033177

                self.repos.populateSack(with='metadata', pickleonly=1)
                self.repos.populateSack(with='filelists', pickleonly=1)
                self.repos.populateSack(with='otherdata', pickleonly=1)
这段代码怎么改?

第二个with 我可以照着该为mdtype.

麻烦106033177你帮我看看。。

作者: ddd010   发布时间: 2011-07-02