2,209,180 questions
0
votes
0
answers
12
views
Multithreading becomes much slower than multiprocessing in free-threaded Python
Consider the following executable Python script mtmp.py:
import numpy as np
import os
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
# `x` is referenced `n_loop` times.
def ...
2
votes
1
answer
9
views
pyDatalog: NameError when asserting a predicate from within a Python loop
I am using pyDatalog to work with a grid-based system. My goal is to iterate over a standard Python list of lists (a grid) and, based on a condition, assert new facts (predicates) into the pyDatalog ...
0
votes
1
answer
14
views
Python Gemini Live API ConnectionClosedError when trying to load previous conversation in the new one
I'm working with Gemini Live API and I want to load previous conversation context to my current live session, allowing me to resume any session from the local save.
So far I've come up with this code:
...
0
votes
0
answers
22
views
Google cloud run workers best option
I have a question regarding google cloud run, in my python code im using uvicorn with workers locally so when deploying to cloud run i searched for the optimal number of workers and i found that when ...
0
votes
1
answer
15
views
What could cause a SendGrid 401 error even with a valid API key and verified sender domain?
Despite double checking my API key, permissions and domain verification - I persistently got a 401 error when trying to send an email via SendGrid using their Python SDK
message = Mail(
...
1
vote
1
answer
28
views
How to get VSCode Python import suggestions to use shorter public alias rather than private
When I get import suggestions in VSCode they always import from the module where the thing was defined, even if that's a private module and the thing is re-exported in some public module. I would ...
0
votes
1
answer
39
views
SQL integration and multiply on huge dataset
I would like to find an efficient method to multiply 2 array element by element then integrate the result.
My table contain primary key, then 5 lists of real (16 bits) : time, channel A, B, C and D. ...
-1
votes
0
answers
14
views
How do I add a Webots speaker node?
I want to to add a speaker node in Python. I have make a robot node, then I add the speaker node in the robot's children. But when I run the code, it say this:
INFO: music_controller: Starting ...
0
votes
1
answer
14
views
JsonOutputParser in LangChain raises OutputParserException when model includes conversational text
I am using LangChain to extract structured data from a user query using gpt-3.5-turbo. I have defined a Pydantic object and am passing the format instructions to the prompt.
However, occasionally the ...
0
votes
0
answers
21
views
Decide if the Qt close event is user or system-generated
I have written a Qt program that runs often on my MacOS machine and I have added code to catch the closeEvent when the window is closed, primarily to stop me closing it accidentally. The closeEvent() ...
0
votes
1
answer
66
views
Unable to add packages to uv project in Ubuntu
Following a tutorial on uv (version 0.9.18) I have been creating a project as:
uv init new_app
and then in that folder I tried to add two packages like
uv add --link-mode copy flask requests
but ...
-1
votes
0
answers
52
views
How to make it so that once the song is finished playing no more turtles move on the screen? [closed]
To start this code is a part of a huge file that I don't fully think is necessary to paste onto here as the area that has the problem can work on its own. Also, the code is already not working as ...
1
vote
0
answers
53
views
why the order of return variables affect the jax jitted function's performance so much?
In jax, you can donate a function argument to save the execute memory and time, if this argument is not used any more.
If you know that one of the inputs is not needed after the computation, and if ...
-3
votes
0
answers
53
views
How to resolve `ValueError` on line 6? [closed]
I have tried this code where I have to make a program that asks the user how many numbers they want to be printed as mode average or median, or quitting the program. Afterwards, the user has the ...
Advice
0
votes
4
replies
60
views
Python append list
I am a beginner learning GCSE level python, but stuck on this book problem
Here, the num1.txt file data is appended to the temp1list
num1.txt file data:
10,20,30,40
20,30,40,50
30,40,50,60
40,50,60,70
...