我在使用 Quickly 时遇到了一点小问题。它无法导入 Glib,因为我对编程还比较陌生,只有几周的编程经验,我决定尝试按照 Quickly 教程开始使用,因为我目前正在学习 Java 和 XML 用于 Android 应用编程,觉得这很有趣。问题是,我完全不知道该怎么做,也不知道错误到底是什么意思,有谁能帮我吗?
这是我尝试通过终端运行它时收到的错误:
ERROR:root:Could not find any typelib for Glib
\Traceback (most recent call last):
File "bin/jokky", line 32, in module
import jokky
File "/home/abunujum/Quickly/jokky/jokky/__init__.py", line 14, in module
from jokky import JokkyWindow
File "/home/abunujum/Quickly/jokky/jokky/JokkyWindow.py", line 18, in module
from gi.repository import Glib # pylint: disable=E0611
ImportError: cannot import name Glib
代码如下:
import gettext
from gettext import gettext as _
gettext.textdomain('jokky')
from gi.repository import Gtk # pylint: disable=E0611
import logging
logger = logging.getLogger('jokky')
from jokky_lib import Window
from jokky.AboutJokkyDialog import AboutJokkyDialog
from jokky.PreferencesJokkyDialog import PreferencesJokkyDialog
from gi.repository import Glib # pylint: disable=E0611
import os
class JokkyWindow(Window):
__gtype_name__ = "JokkyWindow"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(JokkyWindow, self).finish_initializing(builder)
self.AboutDialog = AboutJokkyDialog
self.PreferencesDialog = PreferencesJokkyDialog
# Code for other initialization actions should be added here.
def on_mnu_save_activate(self, widget, data=None):
#get the title for the note
title = self.ui.entry1.get_text()
#get the string
buff = self.ui.textview1.get_buffer()
start_iter = buff.get_start_iter()
end_iter = buff.get_end_iter()
text = buff.get_text(start_iter, end_iter, True)
#create the filename
data_dir = Glib.get_user_data_dir()
jokky_dir = os.path.join(data_dir, "jokky")
filename = os.path.join(jokky_dir, title)
#write the data
Glib.mkdir_with_parents(jokky_dir, 0o700)
Glib.file_set_contents(filename, text)
框里的代码是我写的大部分代码
抱歉,问题这么长,我需要帮助快速使用!
答案1
不是GLib
,是Glib
你打错了,应该是大写的L
。