alo*_*odi 5 gui python printing gobject
升级到 Ubuntu 14.04 后,gnome 中的对话框 system-config-printer 在从命令行调用时遇到问题:
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".
Run Code Online (Sandbox Code Playgroud)
当我尝试更改包中的建议导入时,问题仍然存在,即,
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
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。
修改系统文件不是一个好主意,而是首先检查您是否拥有相应软件包的最新版本:
dpkg-query -W system-config-printer-gnome
Run Code Online (Sandbox Code Playgroud)
它应该返回:
system-config-printer-gnome 1.4.3+20140219-0ubuntu2.1
Run Code Online (Sandbox Code Playgroud)
然后尝试使用 apt-get 重新安装软件包:
sudo apt-get update
sudo apt-get install --reinstall system-config-printer-gnome
Run Code Online (Sandbox Code Playgroud)