Error while humansize module import. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Error while humansize module import. (/thread-26263.html) |
Error while humansize module import. - johnkgson - Apr-25-2020 Error message while trying to import humansize. Please help from humansize import approximate_sizeThe error message is: Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> from humansize import approximate_size ModuleNotFoundError: No module named 'humansize' (I am having humansize ver. 1.0 in pip list.) Please help me. RE: Error while humansize module import. - Jeff900 - Apr-25-2020 I tried it too but for some reason I cannot find any code intalled after the installation, but indeed humansize is in pip list... i can only find the zipfile with some metadata and stuff. On PyPi there is no documentation at all. But I searched on GitHub and got some alternatives you may want to look into. RE: Error while humansize module import. - snippsat - Apr-25-2020 The file is not in PyPi repo only setup.py. The file is still on the web. Just save save as humansize.py and use it as module.>>> from humansize import approximate_size >>> >>> approximate_size(1024) '1.0 KiB' >>> approximate_size(4096) '4.0 KiB' >>> approximate_size(100000) '97.7 KiB' >>> approximate_size(10000000000000) '95.4 MiB' >>> approximate_size(10000000000000) '9.1 TiB' RE: Error while humansize module import. - johnkgson - Apr-26-2020 Thank you, it worked. Even though I had to add a new path to make it global. import sys sys.path.append(r'C:\Users\JOHNSON K G\AppData\Local\Programs\Python\Python38\Lib\site-packages\humansize-1.0-py3.8.egg-info') |