<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>My PyQt5 app so far runs well. But trying to add functionality
requiring asyncio results in failure.</p>
<p>I tried to integrate the telegram-bot function (pip:
python-telegram-bot). When using the old version 13.15 I got it
running, but I am swamped with deprecation warning. But the new
version 20.6 mandates the use of asyncio, and here is where I lack
understanding; I can't get it to work.</p>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><div><span
style="color: #001080;">This is working code of the old app:</span></div><div><span
style="color: #001080;">
</span></div><div><span style="color: #001080;">ex</span><span
style="color: #3b3b3b;"> </span><span style="color: #000000;">=</span><span
style="color: #3b3b3b;"> </span><span style="color: #267f99;">ggeiger</span><span
style="color: #3b3b3b;">()
</span></div><div><span style="color: #3b3b3b;">...
</span><span style="color: #0000ff;">class</span><span
style="color: #3b3b3b;"> </span><span style="color: #267f99;">ggeiger</span><span
style="color: #3b3b3b;">(</span><span style="color: #267f99;">QMainWindow</span><span
style="color: #3b3b3b;">):</span></div></div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;"> </span><span style="color: #0000ff;">def</span><span
style="color: #3b3b3b;"> </span><span style="color: #795e26;">__init__</span><span
style="color: #3b3b3b;">(</span><span style="color: #001080;">self</span><span
style="color: #3b3b3b;">):</span><div><span style="color: #3b3b3b;"> </span><span
style="color: #a31515;">"""init the ggeiger class"""</span></div><span
style="color: #3b3b3b;"></span><span style="color: #3b3b3b;"> </span><span
style="color: #267f99;">super</span><span style="color: #3b3b3b;">().</span><span
style="color: #795e26;">__init__</span><span style="color: #3b3b3b;">()</span></div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;">
</span></div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;">
</span></div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;">Adding async and await all the way up to this point works, but with e.g. this (and other attempts) it fails:</span></div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;"></span>
</div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;"></span><div><span style="color: #001080;">ex</span><span
style="color: #3b3b3b;"> </span><span style="color: #000000;">=</span><span
style="color: #3b3b3b;"> await </span><span style="color: #267f99;">ggeiger</span><span
style="color: #3b3b3b;">()
</span></div><div><span style="color: #3b3b3b;">...
</span><span style="color: #0000ff;">class</span><span
style="color: #3b3b3b;"> </span><span style="color: #267f99;">ggeiger</span><span
style="color: #3b3b3b;">(</span><span style="color: #267f99;">QMainWindow</span><span
style="color: #3b3b3b;">):</span></div><div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;"> async </span><span
style="color: #0000ff;">def</span><span style="color: #3b3b3b;"> </span><span
style="color: #795e26;">__init__</span><span style="color: #3b3b3b;">(</span><span
style="color: #001080;">self</span><span style="color: #3b3b3b;">):</span><div><span
style="color: #3b3b3b;"> </span><span style="color: #a31515;">"""init the ggeiger class"""</span></div><span
style="color: #3b3b3b;"></span><span style="color: #3b3b3b;"> </span><span
style="color: #267f99;">await super</span><span
style="color: #3b3b3b;">().</span><span style="color: #795e26;">__init__</span><span
style="color: #3b3b3b;">()</span></div>
</div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;">I guess it is possible? Any pointers welcome?</div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;">
</div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;">ullix</div>
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;">
<div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 15px;line-height: 20px;white-space: pre;"><span
style="color: #3b3b3b;">
</span></div>
</div>
<p></p>
</body>
</html>