Skip to main content

All Questions

4 votes
0 answers
791 views

Python synchronous pyaudio data in asynchronous code

Here is my use-case: I am streaming some audio from a microphone using Pyaudio. I receive chunks of audio data every x milliseconds. I am opening a websockets connection if some condition is met. ...
HGLR's user avatar
  • 366
-3 votes
3 answers
605 views

python asynchronous map function that apply a function to every element of a list [closed]

I have a list of elements in python that I want to apply an API call to. The API involves web requests and I want to apply it synchronously. Since it is a third party API I can't really modify the ...
Julian Chu's user avatar
  • 2,070
2 votes
0 answers
969 views

Use cases for threading and asyncio in python

I've read quite a few articles on threading and asyncio modules in python and the major difference I can seem to draw (correct me if I'm wrong) is that in, threading: multiple threads can be used to ...
Biswadeep Sarkar's user avatar
1 vote
0 answers
81 views

How to make a python multi-threading scraper as a websocket server

I currently have a python multi-threading scraper that looks like following, how can I turn this into a websocket server so that it can push message once the scraper found some new data? Most ...
MachineLearner's user avatar
0 votes
1 answer
34 views

Asyncio getting different outputs

In the first example I am getting output I expect here to be, but I can't say same about second example. Technically, in both example I have 3 tasks (Just in second example, I am scheduling 2 coros ...
varuserx's user avatar
0 votes
1 answer
846 views

How can I run asyncio in different classes simultaneously

How can I run asyncio in different classes simultaneously? For example, I have first class, where I have method async def main(). I have second class, where method display_info, which must always ...
Bitcoin Earn's user avatar
0 votes
0 answers
146 views

Is there any way to get the result of an async method without blocking?

I'm providing some services through REST API that will occurs DB operation while performing a request. So i'm trying to create a class that performs queries using oracledb(cx_Oracle). A problem arises ...
Kyon's user avatar
  • 75
0 votes
1 answer
177 views

Process async results in another thread - app architecture (python-3.7)

I have a programm that receives Data (Trades) from the Binance API. This data will be processed and visualized in a web-app with dash and plotly. In order to get best performance and the slightest ...
Benix6's user avatar
  • 1
1 vote
1 answer
254 views

Should Python process wait for a job forked using `run_in_executor`, although I did not wait for?

Assume we have the following script: def sync_sleep(x): print("sync_sleep going to sleep") time.sleep(x) print("sync_sleep awake") async def main(): loop = asyncio....
adnanmuttaleb's user avatar
1 vote
1 answer
2k views

How to return values ​from an asynchronous function that is executed in a thread in python?

I am new to asynchronous functions and threads, and I am trying to return a series of values ​​obtained from a Web socket to pass to another thread where synchronous code is executing. In the code, I ...
Abner's user avatar
  • 71
0 votes
0 answers
485 views

Asyncio: Create One Event Loop Per Child Thread

Context I'm using Python Playwright's asynchronous API to test a web application. I want to run two batches of coroutines in two child threads concurrently where each thread will have its own event ...
rednafi's user avatar
  • 1,731
2 votes
1 answer
429 views

How to evaluate multiple functions on one generator using asyncio instead of threading?

The Goal This effort is towards creating an efficient solution to the following problem. source = lambda: range(1 << 24) # for example functions = (min, max, sum) # for example data = tuple(...
YoungCoder5's user avatar
1 vote
0 answers
627 views

StreamConn unsubscribe() and close() appear not to work (AlpacaAPI), seeking opinions

Just getting into working with the Alpaca API (also uses the Polygon IO service) and ran into the following issue, which appears like it should be straightforward, but I'm stuck. The code initializes ...
Deuce's user avatar
  • 41
0 votes
1 answer
216 views

Python3.5 Async execution similar to Java-SpringBoot @EnableAsync @Async annotations

I want to simulate an async python3.5 function similar to what we have in Java with the SpringBoot @EnableAsync @Async annotation. In Spring, methods annotated with the @Async annotation, control is ...
S34N's user avatar
  • 8,381
9 votes
2 answers
5k views

Debugging an async program in the pycharm debugger

My request is to get debugging data from the debugger and pycharm prompt: Lets say I have an-old-style python synchronous program with a bug: def listdir(self, remote_path): with ssh....
Mickey Perlstein's user avatar

15 30 50 per page