「Zim」- 常见错误汇总

  CREATED BY JENKINSBOT

Address already in use / Listener did not start

问题描述

INFO: This is zim 0.65
WARNING: Could not find all icon sizes for the application icon
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
	self.run()
......
  File "/usr/lib/python2.7/socket.py", line 228, in meth
	return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use

ERROR: Exception in main()
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/zim/main/init.py", line 741, in main
	ZIM_APPLICATION.run(*argv[1:])
......
  File "/usr/local/lib/python2.7/dist-packages/zim/main/ipc.py", line 97, in start_listening
	raise AssertionError, 'Listener did not start'
AssertionError: Listener did not start

问题原因

强制结束 Zim 进程;

解决方法

删除 /tmp/zim-root 文件夹。https://answers.launchpad.net/zim/+question/236195

ImportError: No module named gobject

问题描述

	from zim.signals import SignalEmitter, SIGNAL_AFTER
  File "/usr/local/lib/python2.7/dist-packages/zim/signals.py", line 8, in <module>
	import gobject
ImportError: No module named gobject

问题原因

缺少 python-gobject 模块

解决方案

# Ubuntu 16.04 LTS
apt-get install python-gobject-2

# 其他的发行版也是类似的名称

ImportError: No module named gtk

问题描述

  File "/usr/local/lib/python2.7/dist-packages/zim/main/init.py", line 572, in _run_cmd
	self._run_main_loop(cmd)
  File "/usr/local/lib/python2.7/dist-packages/zim/main/init.py", line 579, in _run_main_loop
	import gtk, gobject
ImportError: No module named gtk

问题原因

缺少 python-gtk2 模块

解决方案

# Ubuntu 16.04 LTS
apt-get install python-gtk2

# 其他的发行版也是类似的

You must not use 8-bit bytestrings…

问题描述

ProgrammingError: You must not use 8-bit bytestrings unless you use a text_facto
ry that can interpret 8-bit bytestrings (like text_factory = str). It is highly
recommended that you instead just switch your application to Unicode strings.

问题原因

运行 Zim 内置的 WebServer 时,访问“首页”时产生了该问题。这里的“首页”指的是Zim默认的一个索引页面(此时的 URL 中没有任何页面参数,形如`http://localhost:8080/’)。并且我们在页面中使用了如下的模板代码才触发了这个问题:

<title>
[% FOR page IN pages %]
[% page.title %]
[% END %] - www.k4nz.com
</title>

在文件名中,存在 Unicode 字符。

解决方案

找到文件名中的那个中文字符。