diff --git a/libqnotero/preferences.py b/libqnotero/preferences.py index 893e4ca..5ddbe25 100644 --- a/libqnotero/preferences.py +++ b/libqnotero/preferences.py @@ -46,7 +46,6 @@ def __init__(self, qnotero, firstRun=False): QDialog.__init__(self) self.qnotero = qnotero uiPath = os.path.join(os.path.dirname(__file__), 'ui', 'preferences.ui') - print('Preferences.__init__(): loading preferences ui from %s' % uiPath) self.ui = uic.loadUi(uiPath, self) self.ui.labelLocatePath.hide() if not firstRun: diff --git a/libqnotero/qnotero.py b/libqnotero/qnotero.py index c2bbe32..880c67c 100644 --- a/libqnotero/qnotero.py +++ b/libqnotero/qnotero.py @@ -50,7 +50,6 @@ def __init__(self, systray=True, debug=False, reset=False, parent=None): QMainWindow.__init__(self, parent) uiPath = os.path.join(os.path.dirname(__file__), 'ui', 'qnotero.ui') - print('qnotero.__init__(): loading Qnotero ui from %s' % uiPath) self.ui = uic.loadUi(uiPath, self) if not reset: self.restoreState() @@ -63,7 +62,7 @@ def __init__(self, systray=True, debug=False, reset=False, parent=None): self.minimizeOnClose = True else: self.minimizeOnClose = False - if getConfig(u"firstRun"): + if getConfig(u"firstRun") or not os.path.exists(getConfig('zoteroPath')): self.preferences(firstRun=True) if getConfig(u"autoUpdateCheck"): self.updateCheck() @@ -228,13 +227,12 @@ def runResult(self, listWidgetItem): if listWidgetItem.zoteroItem.fulltext == None: return pdf = listWidgetItem.zoteroItem.fulltext - if os.name == u"nt": + if os.name == 'nt': os.startfile(pdf) else: # For some reason, the file must be encoded with latin-1, despite # the fact that it's a utf-8 encoded database and filesystem! - pdf = pdf.encode(u'latin-1') - reader = getConfig(u'pdfReader').encode(sys.getfilesystemencoding()) + reader = getConfig('pdfReader').encode(sys.getfilesystemencoding()) pid = subprocess.Popen([reader, pdf]) self.popDown() diff --git a/libzotero/libzotero.py b/libzotero/libzotero.py index efa078e..90221e4 100644 --- a/libzotero/libzotero.py +++ b/libzotero/libzotero.py @@ -99,8 +99,8 @@ def __init__(self, zotero_path, noteProvider=None): """ assert(isinstance(zotero_path, str)) - - print(u"libzotero.__init__(): zotero_path = %s" % zotero_path) + print(u"libzotero.__init__(): zotero_path = %s" % bytes(zotero_path, + 'utf-8')) # Set paths self.zotero_path = zotero_path self.storage_path = os.path.join(self.zotero_path, u"storage") @@ -270,6 +270,10 @@ def update(self, force=False): # by "storage:" if att[:8] == u"storage:": item_attachment = att[8:] + # The item attachment appears to be encoded in + # latin-1 encoding, which we don't want, so recode. + item_attachment = item_attachment.encode( + 'latin-1').decode('utf-8') attachment_id = item[2] if item_attachment[-4:].lower() in \ self.attachment_ext: diff --git a/qnotero b/qnotero index da19c1f..a8290cb 100755 --- a/qnotero +++ b/qnotero @@ -37,7 +37,7 @@ if __name__ == "__main__": import socket print(u"qnotero: Qnotero already running, sending activate signal") sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - sock.sendto(u"activate", (u"localhost", getConfig(u"listenerPort")) ) + sock.sendto(b"activate", (u"localhost", getConfig(u"listenerPort")) ) sys.exit() # Normal start of Qnotero