padawan-php / padawan.sublime

A ST3 plugin for padawan.php completion server
MIT License
11 stars 2 forks source link

Add python 2 support. #4

Closed twistor closed 7 years ago

twistor commented 7 years ago

Trying to use this on Fedora 25 and having problems because it's using python 2.

mkusher commented 7 years ago

omg, but than python3 support will be broken?

twistor commented 7 years ago

No, this doesn't change the behavior for Python 3. The only difference is that the imports have changed from 2 to 3. So, we try to import from Python 3, and if that fails, try to import from Python 2.

try:
    from urllib.parse import urlencode
    from urllib.request import urlopen
    from urllib.request import Request
    from urllib.request import URLError
except ImportError:
    from urllib import urlencode
    from urllib2 import urlopen
    from urllib2 import Request
    from urllib2 import URLError
mkusher commented 7 years ago

oh, I see, thx!