Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.Code that causes the issue
from telethon import TelegramClient, events, sync
from telethon import connection
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.functions.messages import GetHistoryRequest
config = configparser.ConfigParser()
config.read("config.ini")
api_id = config['Telegram']['api_id']
api_hash = config['Telegram']['api_hash']
username = config['Telegram']['username']
client = TelegramClient(username, api_id, api_hash)
client.start()
...
with client:
client.loop.run_until_complete(main())
Traceback
$ python3 test.py
Abort trap: 6
MacOS 10.15.1
Python 3.7.5
Telethon 1.10.9
I was able to fix this problem
So overall, the steps were:
1) brew update && brew upgrade && brew install openssl
2) cd /usr/local/Cellar/openssl/1.0.2t/lib
3) sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
4) cd /usr/local/lib
5) mv libssl.dylib libssl_bak.dylib
6) mv libcrypto.dylib libcrypto_bak.dylib
7) sudo ln -s libssl.1.0.0.dylib libssl.dylib
8) sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
I'd like to re-open this bug.
The workaround by @denilen is a hack. The underlying issue is that macOS prohibits the loading of unversioned crypto libraries.
Loading in Telethon is performed here:
https://github.com/LonamiWebs/Telethon/blob/master/telethon/crypto/libssl.py#L17
There is some debugging here: https://www.shh.sh/2020/01/04/python-abort-trap-6.html
Their proposed fix is:
# if we are on catalina, we want to strongly version libssl since unversioned libcrypto has a non-stable ABI
if sys.platform == 'darwin' and platform.mac_ver()[0].startswith('10.15') and libssl_path.endswith('libssl.dylib'):
# libssl.44.dylib is in libressl-2.6 which as a OpenSSL 1.0.1-compatible API
libssl_path = libssl_path.replace('libssl.dylib', 'libssl.44.dylib')
See MR here: https://github.com/wbond/oscrypto/pull/36/files
Pinning the used version is ugly, but there does not seem any way around it.
Closed by #1369, thank you for the very responsive review and fast fix @Lonami !
Most helpful comment
I was able to fix this problem
So overall, the steps were:
1) brew update && brew upgrade && brew install openssl
2) cd /usr/local/Cellar/openssl/1.0.2t/lib
3) sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
4) cd /usr/local/lib
5) mv libssl.dylib libssl_bak.dylib
6) mv libcrypto.dylib libcrypto_bak.dylib
7) sudo ln -s libssl.1.0.0.dylib libssl.dylib
8) sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib