pylakey/aiotdlib

AttributeError: module 'signal' has no attribute 'SIGQUIT'

V1lu0 opened this issue · 7 comments

V1lu0 commented

windwos10,Python 3.9.6,use the example code

import asyncio
import logging

from aiotdlib import Client

API_ID = ***
API_HASH = "***"
PHONE_NUMBER = "+***"


async def main():
    client = Client(
        api_id=API_ID,
        api_hash=API_HASH,
        phone_number=PHONE_NUMBER
    )

    async with client:
        me = await client.api.get_me()
        logging.info(f"Successfully logged in as {me.json()}")


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    asyncio.run(main())

`

C:\Users\*****\Desktop\*****\python3>python 1.py
Traceback (most recent call **last):
  File "C:\Users\*****\Desktop\telegram-nearby-map\python3\1.py", line 4, in <module>
    from aiotdlib import Client
  File "D:\*****\base\Python39\lib\site-packages\aiotdlib\__init__.py", line 3, in <module>
    from .client import (
  File "D:\*****\base\Python39\lib\site-packages\aiotdlib\client.py", line 164, in <module>
    class Client:
  File "D:\*****\base\Python39\lib\site-packages\aiotdlib\client.py", line 769, in Client
    async def idle(self, stop_signals: tuple = (signal.SIGINT, signal.SIGTERM, signal.SIGABRT, signal.SIGQUIT)):
AttributeError: module 'signal' has no attribute 'SIGQUIT'

Thanks for your feedback. Library was not tested on Windows. This bug will be fixed in the next release.

You can use WSL as workaround to make this library work for you

Should be fixed in 0.8.5

V1lu0 commented

Should be fixed in 0.8.5

Thanks

V1lu0 commented

Should be fixed in 0.8.5
I tried again and found the following error, is not I need to compile a libtdjson.1.7.6. DLL to add below.The environment and code are the same as above

C:\Users\*****\*****\python3>python 1.py
Traceback (most recent call last):
  File "C:\Users\*****\python3\1.py", line 25, in <module>
    asyncio.run(main())
  File "D:\*****\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\*****\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\*****\python3\1.py", line 12, in main
    client = Client(
  File "D:\*****\Python39\lib\site-packages\aiotdlib-0.8.5-py3.9.egg\aiotdlib\client.py", line 283, in __init__
  File "D:\*****\Python39\lib\site-packages\aiotdlib-0.8.5-py3.9.egg\aiotdlib\tdjson.py", line 60, in __init__
  File "D:\*****\Python39\lib\site-packages\aiotdlib-0.8.5-py3.9.egg\aiotdlib\tdjson.py", line 31, in _get_tdjson_lib_path
  File "D:\*****\Python39\lib\site-packages\pkg_resources\__init__.py", line 1130, in resource_filename
    return get_provider(package_or_requirement).get_resource_filename(
  File "D:\*****\Python39\lib\site-packages\pkg_resources\__init__.py", line 1739, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "D:\*****\Python39\lib\site-packages\pkg_resources\__init__.py", line 1761, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'aiotdlib\\tdlib\\libtdjson.1.7.6.dll'

As it described in README, this package includes prebuilt TDLib binaries only for macOS and Linux. You can use your own binary by passing library_path argument to Client class constructor. Make sure it's built from this commit. Compatibility with other versions of library is not guaranteed.

As alternative you can use WSL to make it work without building TDLib on Windows

Also if you familiar with Docker you can use this image to run on every system which Docker supports

V1lu0 commented

thanks