在我升级到 Ubuntu 14.04 之后,gnome 中的系统配置打印机对话框在从命令行调用时遇到问题:
sudo system-config-printer
Traceback (most recent call last):
File "/usr/share/system-config-printer/system-config-printer.py", line 72, in <module>
from gi.repository import GObject # for TYPE_STRING and TYPE_PYOBJECT
File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 32, in <module>
raise ImportError('When using gi.repository you must not import static '
ImportError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".
当我尝试更改包中建议的导入时,问题仍然存在,即
cd /usr/share/system-config-printer
sed -i 's/import gobject/from gi.repository import GObject/g' *.py
sed -i 's/gobject/GObject/g' *.py
感谢您的帮助。
答案1
修改系统文件不是一个好主意,而是先检查您是否拥有相应系统的最新版本包裹:
dpkg-query -W system-config-printer-gnome
它应该返回:
system-config-printer-gnome 1.4.3+20140219-0ubuntu2.1
然后尝试使用 apt-get 重新安装该软件包:
sudo apt-get update
sudo apt-get install --reinstall system-config-printer-gnome