Closed Th3Tr00p3r closed 1 year ago
Hi, thank you for reporting this. This is something that qasync should support. Currently the QEventLoop
type is created based on that os.name
check as you pointed out.
When you say you "override" the condition check, do you simply replace this line in init.py?
- QIOCPEventLoop = type("QIOCPEventLoop", (_QEventLoop, _ProactorEventLoop), {})
+ QIOCPEventLoop = type("QIOCPEventLoop", (_QEventLoop, _SelectorEventLoop), {})
Setting different policies should at least be possible with set_event_loop_policy()
.
@Th3Tr00p3r you can also try creating your loop by using the QSelectorEventLoop directly.
loop = qasync.QSelectorEventLoop()
@Th3Tr00p3r you can also try creating your loop by using the QSelectorEventLoop directly.
loop = qasync.QSelectorEventLoop()
This appears to completely solve the issue! Thank you so much!
Hi, I am currently using this truly great package for making an application which features a PyQt5 GUI and an asynchronously connected postgreSQL database (using psycopg). I'm currently developing on windows, which means the default event loop policy is 'WindowsProactorEventLoopPolicy'. However, psycopg async connection requires a 'WindowsSelectorEventLoopPolicy' policy to work.
I managed to solve this by manually overriding the
if os.name != "nt":
condition in the init.py script. Now the async connection seems to work great.It would be nice to have an optional choice of policy for cases like this. I guess I could try to make this into a pull request if the overall idea makes any sense. If there is a way to do this that I missed, please let me know...
cheers!