lektor / lektor-website

The main lektor website.
https://www.getlektor.com/
Other
160 stars 134 forks source link

fix: (:green_apple:) get it work for python 2.7.16 #278

Closed Jeff-Tian closed 4 years ago

Jeff-Tian commented 5 years ago

See https://github.com/lektor/lektor/issues/676, in python 2.7.16 it will throw 'No JSON object could be decoded'

nixjdm commented 5 years ago

I've read https://github.com/lektor/lektor/issues/676. Do you have a more specific link explaining this changed just for 2.7.16? I can't find that on the docs link in that issue.

That said, I'll take a fix for this, but I'd prefer using something like

try:
    [python3 way]
except ImportError:
    [older way]

using another except if there's actually three methods required, like if the 2.7.15 way != the 2.7.16 way != the 3 way.

Thanks for finding this!

Jeff-Tian commented 5 years ago

Sorry I didn't find specific link, I just noticed that urllib.urlopen().read() doesn't work on python 2.7.16, and happen to find some code uses urllib**2**.urlopen().read(). And I tried it then it works!

When I search the doc, it has only equal or higher versions than 2.7.16:

image

xlotlu commented 4 years ago

deprecated by #298, thanks