mirukana / mirage

A fancy, customizable, keyboard-operable Qt/QML & Python Matrix chat client for encrypted and decentralized communication.
GNU Lesser General Public License v3.0
412 stars 40 forks source link

error when uploading image: time has no attribute clock #223

Open 3nt3 opened 3 years ago

3nt3 commented 3 years ago

Description

@xyz@xyz.xyz.send_file.18b4113d-921e-4fbe-8a49-ded39180580d

Traceback (most recent call last):
  File "qrc:/src/backend/qml_bridge.py", line 91, in on_done
    result = future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 438, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
  File "qrc:/src/backend/matrix_client.py", line 696, in send_file
    await self._send_file(item_uuid, room_id, path, reply_to_event_id)
  File "qrc:/src/backend/matrix_client.py", line 755, in _send_file
    url, mime, crypt_dict = await self.upload(
  File "qrc:/src/backend/matrix_client.py", line 1465, in upload
    response, decryption_dict = await super().upload(
  File "/usr/lib/python3.9/site-packages/nio/client/async_client.py", line 2626, in upload
    response = await self._send(
  File "qrc:/src/backend/matrix_client.py", line 262, in _send
    response = await super()._send(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/nio/client/async_client.py", line 740, in _send
    transport_resp = await self.send(
  File "/usr/lib/python3.9/site-packages/nio/client/async_client.py", line 270, in wrapper
    return await func(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/nio/client/async_client.py", line 807, in send
    return await self.client_session.request(
  File "/usr/lib/python3.9/site-packages/aiohttp/client.py", line 544, in _request
    await resp.start(conn)
  File "/usr/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 890, in start
    message, payload = await self._protocol.read()  # type: ignore
  File "/usr/lib/python3.9/site-packages/aiohttp/streams.py", line 604, in read
    await self._waiter
  File "/usr/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 585, in write_bytes
    await self.body.write(writer)
  File "/usr/lib/python3.9/site-packages/aiohttp/payload.py", line 426, in write
    chunk = await self._iter.__anext__()
  File "/usr/lib/python3.9/site-packages/nio/client/async_client.py", line 2479, in _encrypted_data_generator
    async for value in async_encrypt_attachment(data):
  File "/usr/lib/python3.9/site-packages/nio/crypto/async_attachments.py", line 74, in async_encrypt_attachment
    key = Random.new().read(32)
  File "/home/ente/.local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/home/ente/.local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
    return _UserFriendlyRNG.read(self, bytes)
  File "/home/ente/.local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
    self._ec.collect()
  File "/home/ente/.local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
    t = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Your environment

Steps to reproduce

  1. Send image

Expected behavior

Tell us what should happen

Actual behavior

Tell us what happens instead

mirukana commented 3 years ago

It seems like you have the deprecated package PyCrypto installed locally, and this gets imported before PyCryptodome which should have been installed by the AUR as a dependency of python-matrix-nio. Try running pip uninstall PyCrypto.