squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

fix exception handling for python version < 3.6 #15

Closed vipul-sharma20 closed 7 years ago

vipul-sharma20 commented 7 years ago

Use ImportError in place of ModuleNotFoundError

Considering that this is meant to support Python 3.5 too

reference: https://docs.python.org/3/library/exceptions.html#ModuleNotFoundError

Thanks and you've done a nice work on this project.

squeaky-pl commented 7 years ago

Hi, yes indeed. I was coding and testing last month on 3.6 only. I would prefer this to be conditional, on py3.6 use exception I used and on py3.5 fallback to more general one. Something like

try:
 ModuleNotFoundError
except NameError
 ModuleNotFoundError = ImportError

in the beginning of the file

vipul-sharma20 commented 7 years ago

Yes, it seems decent. Updated in the latest commit.

squeaky-pl commented 7 years ago

Great, so much thanks.