Questions tagged [python-trio]

Trio is a Python package for async concurrency and I/O that's obsessed with usability and correctness

Official web site

52 questions
1
vote
2 answers

python web scraping from a list of urls

I am new in asks and trio in python, I got a sample code. let me explain I have a list of URL every one is news URLs, each one has sub urls. the first url requests and get all other hrefs and add in a list. then get the article of all hrefs in that…
newuser
  • 61
  • 9
1
vote
1 answer

Combining trio and flask

I'm trying to make an HTTP API that can create and destroy concurrent tasks that open TCP connections to remote servers streaming ~15-second data. I'll have to figure out how to handle the data later. For now I just print it. In the example below, I…
hankivstmb
  • 131
  • 1
  • 10
1
vote
2 answers

Python: ways to synchronize trio tasks and regular threads

I find myself in the situation that I need to synchronize Trio tasks with Python threads. At the moment, I am using threading.Lock objects that Trio tasks have to acquire with trio.run_sync_in_worker_thread(lock.acquire). I think it should also be…
Nikratio
  • 2,138
  • 2
  • 25
  • 40
1
vote
5 answers

Spawn processes and communicate between processes in a trio based Python application

For an internship on the Python library fluidimage, we are investigating if it could be a good idea to write a HPC parallel application with a client/servers model using the library trio. For asynchronous programming and i/o, trio is indeed…
paugier
  • 1,617
  • 2
  • 16
  • 36
0
votes
1 answer

I am using Trio and how do I get the IP address of an already open socket?

This is a simple problem and Im sure there is an solution. I am trying to get the IP address of a socket which I have already connected to. I used trio.serve_tcp(handler, port) to create an server and now I want to know if someone is making…
0
votes
2 answers

what is the exact version of python-trio echo server - multiple client in asyncio?

I am trying to convert the following echo server IRC alike chat terminal into asyncio , but I don't think too much information about trio since it's new, but what is the translation of this to asyncio? import trio from itertools import count from…
etyzz
  • 43
  • 5
0
votes
1 answer

I got a trio input function from a friend and it's trying to use trio.lowleve.FdStream, however I can't find it

I'm getting this error: AttributeError: module 'trio.lowlevel' has no attribute 'FdStream'. FdStream isn't in the trio code on git nor in my installation. Is there an alternative to this, or is there a different version I did't find?
merolé
  • 3
  • 3
0
votes
1 answer

Right way to terminate a trio program without BrokenResourceError

My app follows a Producer and Consumer pattern. There's a Producer, 2 task (A, B), and a Consumer. Producer reads an sql table and outputs to A & B. They in turn performs some task on that output and sends to Consumer. Consumer reads from A & B and…
Tinker
  • 3,082
  • 6
  • 25
  • 53
0
votes
1 answer

Unable to validate my query for particular website

I'm trying to query the following website where Access Number will be a fixed value of 8778791867 And the PIN will be dynamic. From the normal browser am able to check if it's valid or invalid pin. But using my code below, I'm unable to get the…
0
votes
0 answers

Trio with Asyncio and starting/closing loops properly

So I am starting my program like this: try: b.loop.call_soon_threadsafe(b.loop.run_in_executor, None, lambda: trio.run(wallpaper)) except BaseException as e: sys.exit(e) try: b.loop.run_until_complete(background_task()) …
0
votes
1 answer

In Trio, how do you write data to a socket without waiting?

In Trio, if you want to write some data to a TCP socket then the obvious choice is send_all: my_stream = await trio.open_tcp_stream("localhost", 1234) await my_stream.send_all(b"some data") Note that this both sends that data over the socket and…
Arthur Tacca
  • 6,565
  • 1
  • 27
  • 42
0
votes
1 answer

How to synchronize two trio co-routines?

I'm going through Trio tutorial and I made an echo-client that sends message to an echo server for 10 seconds: async def sender(client_stream, flag): print("sender: started!") end_time = time.time() + 10 while time.time() < end_time: …
Jenia Ivanov
  • 1,849
  • 1
  • 25
  • 49
0
votes
1 answer

How to use Trio for fast web api calls?

I'm trying to speed up some code that calls an api_caller(), which is a generator that you can iterate over to get results. My synchronous code looks something like this: def process_comment_tree(p): # time consuming breadth first search that…
theQman
  • 1,423
  • 4
  • 24
  • 38
0
votes
0 answers

Kivy application with Trio Async Clock Scheduler

I want a clock scheduler which will fetch the trio receiver channel data. Code below for the same. It is not working as it seems that async/await does not work with it. Control not coming to getEventInputChannel scheduler. class DemoApp(App): …
Sanjiv
  • 653
  • 4
  • 12
0
votes
1 answer

Asynchronous image search on screen with Trio

I'm trying to adapt this module to support asynchronous execution when searching for a lot of images in the same screenshot at a given time. I'm kind of new to async coding and after a lot of research I chose Trio to do it (because of it's…
Teodoro
  • 571
  • 2
  • 12