View Single Post
Old 01-09-2020, 02:21 AM   #9
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
Starting in Feb I have some time to look at this issue. No guarantees: I also don't know P3 (but I trust I can learn what I need to know), have no interest in some plugins, and some others might be too opaque. Of course I must first deal with my own ...

I suggest that people propose here moribund-but-used plugins and see if anyone signs up.
I think it will be the same as what happened for Qt5. We'll fix our own plugins, then fix the ones we use. I have been maintaining a few of kiwidude's, so will do those. And @JimmXinu has been doing the same. But, I'm not in any hurry. Kovid said it would be the middle of the year before the release. I'll do them when I feel like it. Or am doing something else in the plugins.

I'll admit to not knowing Python 3 as well. I have read a couple of brief things, but, I'm following the BFI* method. Start in debug mode, look at the errors for a plugin, fix them, try again. Repeat until it loads. Then test the function and repeat. Then move onto the next plugin. But, apply the changes I did before.

There are a few things I know. For example, all the metadata source plugins I am replacing:
Code:
from urllib.parse import quote, unquote
from urllib import quote, unquote
with:
Code:
try:
    from urllib.parse import quote, unquote
except ImportError:
    from urllib import quote, unquote
try:
    from queue import Empty, Queue
except ImportError:
    from Queue import Empty, Queue
import six
from six import text_type as unicode
That should keep backwards compatibility. With some removals and additions as needed.

Then, any "prints" have to be changed to wrap parentheses around the argument. So, instead of:

Code:
print "The code shouldn't have reached here"
it is:

Code:
print("The code shouldn't have reached here")
Another one I found was:

Code:
except Exception, e:
which should be:

Code:
except Exception as e:
Other changes are:
  • use "items" instead of "iteritems" - Works in 2.7 but, could be slower. Luckily, I'm only using it on small numbers of items.
  • "if whatever is None" rather than "if whatever" - I've been gradually converting this anyway as I prefer it.

If anyone can see a problem with these suggestions, or has a good list of other things to look for, I'd be happy to see it.


(*Brute force and ignorance)
davidfor is offline   Reply With Quote