![]() |
#31 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,316
Karma: 2200073
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Hey @embryo, any plans to make this tool compatible with other OSes? (linux, mac). It shouldn't be too hard to make it work. I don't mean packaging, just running the script with system-wide installed pyside (via pip3).
Thanks for your time! |
![]() |
![]() |
![]() |
#32 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Looks like the dependency isn't Python 3-compatible:
Code:
KoHighlights-0.5.0.0$ python3 main.py Traceback (most recent call last): File "main.py", line 17, in <module> from slppu import slppu as lua # https://github.com/noembryo/slppu File "/home/frans/src/kobo/KoHighlights-0.5.0.0/slppu.py", line 131 print ERRORS['unexp_end_string'] ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(ERRORS['unexp_end_string'])? Edit: yup, works fine. Edit 2: except for this when double clicking on a book since os.startfile() is apparently Windows-only: Code:
$ python main.py Traceback (most recent call last): File "main.py", line 377, in on_file_table_itemDoubleClicked (os.startfile(path) if isfile(path) else AttributeError: 'module' object has no attribute 'startfile' Code:
import os, sys, subprocess def open_file(filename): if sys.platform == "win32": os.startfile(filename) else: opener ="open" if sys.platform == "darwin" else "xdg-open" subprocess.call([opener, filename]) Last edited by Frenzie; 02-26-2019 at 03:49 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#33 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
@Frenzie Thank you for testing..
I've made the slppu.py python 3.x compatible and also added the function to open the books on other OSes. What do you mean by "the APPDATA thing"? EDIT: Ah, you meant the os.environ["APPDATA"] that is used for the SETTINGS_DIR variable... How about using this: Code:
if sys.platform == "win32": # Windows SETTINGS_DIR = join(os.environ["APPDATA"], APP_NAME) elif sys.platform == "darwin": # MacOS SETTINGS_DIR = join(os.path.expanduser("~"), "Library", "Application Support", APP_NAME) else: # Linux SETTINGS_DIR = join(os.path.expanduser("~"), "." + APP_NAME) Last edited by embryo; 02-27-2019 at 06:08 AM. |
![]() |
![]() |
![]() |
#34 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Apologies, it's what's keeping the program from starting on non-Windows operating systems. I'm talking about this line.
On Linux and Mac that's HOME followed by some stuff (different on both platforms I'm afraid, though HOME would suffice as a rather dumb implementation). There's a module that abstracts it away for you if desired: https://pypi.org/project/appdirs/ |
![]() |
![]() |
![]() |
#35 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
Quote:
![]() Does it works OK now? |
|
![]() |
![]() |
Advert | |
|
![]() |
#36 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Yes, it now runs fine out of the box, albeit still only in Python 2.7.
![]() Python 3 looks like this: Code:
Traceback (most recent call last): File "main.py", line 29, in <module> from gui_main import Ui_Base # ___ ______ GUI STUFF ________________ File "/home/frans/src/kobo/KoHighlights-master/gui_main.py", line 265, in <module> from main import DropTableWidget File "/home/frans/src/kobo/KoHighlights-master/main.py", line 30, in <module> from gui_about import Ui_About File "/home/frans/src/kobo/KoHighlights-master/gui_about.py", line 106, in <module> import images_rc File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 21, in <module> qInitResources() File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 16, in qInitResources QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) TypeError: 'qRegisterResourceData' called with wrong argument types: qRegisterResourceData(int, str, str, str) Supported signatures: qRegisterResourceData(int, unicode, unicode, unicode) Code:
'Hy'$'\366''kk'$'\344''yksen Tiedot.doc' Code:
Traceback (most recent call last): File "main.py", line 1925, in process self.start_scan() File "main.py", line 1929, in start_scan for dir_tuple in os.walk(self.path): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 296, in walk for x in walk(new_path, topdown, onerror, followlinks): File "/usr/lib/python2.7/os.py", line 286, in walk if isdir(join(top, name)): File "/usr/lib/python2.7/posixpath.py", line 73, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 3: ordinal not in range(128) Code:
elif dir_path.lower().endswith("koreader\\history") Last edited by Frenzie; 02-27-2019 at 08:38 AM. |
![]() |
![]() |
![]() |
#37 | |||
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
Quote:
That's strange.. (no unicode in python 3.x) Quote:
Quote:
Thank you very much for your tests ![]() |
|||
![]() |
![]() |
![]() |
#38 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Quote:
I'll see if I can get the file with the corrupted name to you. It might be difficult seeing how it's corrupted and all, but I suppose tar should preserve it properly. Anyway, I don't have that file on my laptop. ![]() |
|
![]() |
![]() |
![]() |
#39 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
|
![]() |
![]() |
![]() |
#40 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
|
![]() |
![]() |
![]() |
#42 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
Quote:
I guess after that you need Pyside2.. |
|
![]() |
![]() |
![]() |
#43 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
How do you mean exactly? https://packages.debian.org/source/stretch/pyside
But PySide2/Qt5 would be preferable in the long run in any case. ![]() |
![]() |
![]() |
![]() |
#44 | ||
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
Quote:
I read somewhere that it was because of "Pyside could not get installed in Python after version 3.4". I setup another VM (Xubuntu) updated to 18.04 and succeed in installing everything.... and got to the same error as yours ![]() It has to do with the pyside's resource creator (it creates code for Python2). Bypassed it by not using it and loading the images from the original files. Got an error from future.moves.urllib.request.URLError, bypassed it ... got another from ... I'll get there some time in the future ![]() Quote:
I'm a Luddite I know, but I don't want to throw away machines that work fine, just so I can wait more time for loading the newer super duper Word or Photoshop ![]() |
||
![]() |
![]() |
![]() |
#45 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 515
Karma: 64554
Join Date: Aug 2013
Device: Kobo Glo, GloHD
|
OK, the updated script should work with Python 2/3 out of the box.
There is a problem with the settings for the position of the window if python3 loads python2's settings file and vice versa, but everything else works. Even a command-line interface is added.. (never made one before) ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-T1 T1Mizer(Utility app for T1) | fairworld | Sony Reader Dev Corner | 9 | 11-16-2017 08:26 AM |
PDF: Highlights in images correct, copied text from highlights truncated | wonderose | Android Devices | 0 | 08-02-2015 11:25 AM |
Kindle Previewer (a must have utility) | townsend | Sigil | 3 | 05-03-2013 12:13 AM |
Need unzip utility on iLiad | nekokami | iRex | 5 | 04-20-2009 03:18 PM |
ePub Creation Utility | KoopaOne | ePub | 13 | 04-30-2008 10:38 AM |