Skip to content

Commit

Permalink
Merge pull request #37 from dreadatour/master
Browse files Browse the repository at this point in the history
Fix 'ImportError: No module named pkg_resources' error on Google App Engine
  • Loading branch information
youknowone committed May 31, 2017
2 parents 9c9bcd1 + bc19031 commit 16ade8e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions itunesiap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"""

from six import PY3
import pkg_resources
try:
import pkg_resources
except ImportError:
# pkg_resource is not available on Google App Engine
pkg_resources = None

from .request import Request
from .receipt import Response, Receipt, InApp
Expand All @@ -21,10 +25,13 @@
exc = exceptions
env = environment # env.default, env.sandbox, env.review

__version__ = pkg_resources.resource_string('itunesiap', 'version.txt').strip()
if PY3:
__version__ = __version__.decode('ascii') # pragma: no cover
VERSION = tuple(int(v) for v in __version__.split('.'))
if pkg_resources is not None:
__version__ = pkg_resources.resource_string('itunesiap', 'version.txt').strip()
if PY3:
__version__ = __version__.decode('ascii') # pragma: no cover
VERSION = tuple(int(v) for v in __version__.split('.'))
else:
__version__ = VERSION = None

__all__ = (
'Request', 'Response', 'Receipt', 'InApp', 'verify',
Expand Down

0 comments on commit 16ade8e

Please sign in to comment.