DJANGO cannot import name _compare_digest

Thomas Jollans tjol at tjol.eu
Sat Jul 1 06:46:31 EDT 2017


On 30/06/17 13:32, Pavol Lisy wrote:
> [snip]
>
> python 3.6.1 works as I expected
> 
>>>> import logging as operator
>>>> from operator import _compare_digest as compare_digest
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: cannot import name '_compare_digest'
> 

All you're seeing here is that operator._compare_digest doesn't exist in
python3. The behaviour of from ... import has not changed.

Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from operator import _compare_digest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name '_compare_digest'
>>> import logging as os
>>> from os import walk
>>> walk.__module__
'os'



-- Thomas



More information about the Python-list mailing list