Skip to content

Commit

Permalink
Compatible module loading for zip modules #234
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverpool committed Jul 3, 2016
1 parent 5159589 commit 385a49c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions patacrep/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import posixpath
import re
import sys
from zipimport import ZipImportError

from patacrep import utils
from patacrep import __DATADIR__
Expand Down Expand Up @@ -90,6 +91,13 @@ def iter_modules(path, prefix):
else:
try:
yield module_finder.find_spec(name).loader.load_module()
except AttributeError:
# It is a zipimport.zipimporter object
try:
yield module_finder.load_module(name)
except ZipImportError as error:
LOGGER.debug("[plugins] Could not load module {}: {}".format(name, str(error)))
continue
except ImportError as error:
LOGGER.debug("[plugins] Could not load module {}: {}".format(name, str(error)))
continue
Expand Down

0 comments on commit 385a49c

Please sign in to comment.