mailgun / expiringdict

Dictionary with auto-expiring values for caching purposes.
Apache License 2.0
347 stars 76 forks source link

Handle ModuleNotFoundError error raised during installation #30

Closed os closed 7 years ago

os commented 7 years ago

My Python version is 3.6.1 and I get this error during installation:

Collecting expiringdict
  Downloading expiringdict-1.1.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/0n/qnll4nm56h5b98_r8x3yfpc80000gn/T/pip-build-nrgukvzy/expiringdict/setup.py", line 2, in <module>
        import md5  # fix for "No module named _md5" error
    ModuleNotFoundError: No module named 'md5'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/0n/qnll4nm56h5b98_r8x3yfpc80000gn/T/pip-build-nrgukvzy/expiringdict/
horkhe commented 7 years ago

Travis build fails because ModuleNotFoundError does not exist in python 2.7. Please make sure that your changes work for both 2.x and 3.x.

jlu5 commented 7 years ago

Shouldn't the existing code work fine though? ModuleNotFoundError is a subclass of ImportError, so except ImportError should include it as well.

os commented 7 years ago

@GLolol It should and it does from the shell, but that's not the case during installation. Am I missing something here?

Python 3.6.1 (default, Jun  5 2017, 17:08:26) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import md5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'md5'
>>> try:
...     import md5
... except ImportError:
...     print('handled')
... 
handled
os commented 7 years ago

Duplicate of https://github.com/mailgun/expiringdict/pull/29. Closing.