Search code examples
pythondjangopython-3.xdeprecatedpython-importlib

imp.get_suffixes() is deprecated,how to repair it?


I have encountered :

pywintypes.py:39: DeprecationWarning: imp.get_suffixes() is deprecated; 
use the constants defined on importlib.machinery instead

but i don't know how to repair it ? could any one explain for me in detail?


Solution

  • As the message explains you should use the _SUFFIXES constants that are part of importlib.machinery. These were introduced in Python 3.3. The deprecation message means you should now use those constants instead of calling imp.get_suffixes().

    If you can't upgrade to Python 3.3 yet then that's fine (things currently still work) but it's something to be aware of when upgrading in the future.