Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

I cannot find anything on this. I'm getting error:

Traceback (most recent call last):
  File "/path/to/pwdb.py", line 265, in <module>
    password_db()
  File "/path/to/pwdb.py", line 73, in __init__
    self.cipher = AES.new(key,AES.MODE_ECB)
  File "/home/STACKOVERFLOW/.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 95, in new
    return AESCipher(key, *args, **kwargs)
  File "/home/STACKOVERFLOW/.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 59, in __init__
    blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
  File "/home/STACKOVERFLOW/.local/lib/python3.10/site-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
    self._cipher = factory.new(key, *args, **kwargs)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

I'm pretty sure the line it's getting the error from is:

self.cipher = AES.new(key,AES.MODE_ECB)

The script was working not too long ago. Did PyCrypto update its formatting or something ? And does anyone have any idea on how to fix this ? I can provide more of the code if need be.

like image 313
WaXxX333 Avatar asked Sep 06 '25 20:09

WaXxX333


1 Answers

uninstall pycryto and install pycryptodome

pip uninstall pycrypto
pip install pycryptodome
like image 55
Pradeep Kumar Avatar answered Sep 09 '25 16:09

Pradeep Kumar