JHUISI / charm

Charm: A Framework for Rapidly Prototyping Cryptosystems
http://charm-crypto.io
GNU Lesser General Public License v3.0
541 stars 166 forks source link

Make test "time module error" #303

Closed Loryerba closed 5 months ago

Loryerba commented 5 months ago

Hi, im running on Ubuntu 22.04, Python version 3.8.18. I've installed everything, "make" command runs, "make install" runs without error. When i run "make test" i get the following error: _ ERROR collecting charm/schemes/abenc/abenc_yct14.py __ ImportError while importing test module '/home/lorenzo/charm/charm/schemes/abenc/abenc_yct14.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/init.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) charm/schemes/abenc/abenc_yct14.py:22: in from time import clock E ImportError: cannot import name 'clock' from 'time' (unknown location) =============================================== short test summary info ================================================ ERROR charm/schemes/abenc/abenc_yct14.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Also in VSCode when I type "from charm." i can see only some options like build, conftest,doc, embed but not all the module that i need to create schemes.

Some helps please?

Thanks

terry-fee commented 5 months ago

The issue is with the following import statement on line 22 of the file _charm/schemes/abenc/abencyct14.py.

from time import clock

The function clock() was removed from Python versions 3.8 and above.

Use the following import statement instead and replace all occurrences of clock() with time().

from time import time

Loryerba commented 5 months ago

Solved

jakinyele commented 5 months ago

Would you mind submitting a PR with the fix for others?