2,204,850 questions
Score of 1
2 answers
92 views
How to type-hint a function that returns as many values as in its input?
I have a function that takes one or more arguments and returns the same number of values. For a single input value, it returns just one value, not a size one tuple, for multiple values it returns a ...
Score of -5
0 answers
53 views
Buildozer cannot build APKs again
I have been using buildozer==1.5.0 to build my APKs for sometime now since I have understood the basics. I use Arch Linux and I have learnt to build a specific Virtual Environment(which the one I have ...
Score of 0
0 answers
47 views
PySide6 Custom widget with Enum property
In PySide6, I'm trying to create a custom widget and register it as a plugin in Qt Designer. My widget has one attribute that is an enum.
It displays correctly in Qt Designer, I can change the value ...
Score of 4
1 answer
124 views
Why can moving an await change whether a Python object remains reachable, even when the object has no explicit strong reference?
I am trying to understand a surprising difference in object lifetime in Python asyncio.
Consider this simplified example:
import asyncio
import gc
import weakref
class Resource:
def __init__(self, ...
Score of -4
1 answer
95 views
Python Library/Module Won't Import While Others Do
Mac os Sequoia 15.6
I installed the exifread library using pip as well as conda. In Anaconda Navigator it shows as installed. Using a terminal window I type in:
pip3 show exifread
and it returns
/opt/...
Score of -5
1 answer
173 views
Opened .txt file seems to be empty after a for in function [duplicate]
edit: sorry I wasn't up to the standards, I thought I had everything in order. That said, thanks for the people that answered and helped, file.seek(0) worked! I really couldn't find anything online ...
Score of -7
0 answers
82 views
How should I start to learn gRPC using Python? [closed]
I am confused there are very few sources available for gRPC in Python, lots of resources for Java , how do i look for python? what is the way to learn it. i want to learn without help of AI, it's ...
Score of 1
1 answer
120 views
How can I make numpy arrays the same shape before doing conditional computations?
Let's say I have a conditional calculation like this
import numpy as np
def foo(a, b, c):
if a <= 0 or c == 0:
return foo_special(a, b, c)
return foo_normal(a, b, c)
def ...
Score of -7
1 answer
114 views
How can I test Stack Overflow API write operations?
I am testing an application that uses the Stack Exchange API to perform write operations on Stack Overflow.
I have successfully tested several read operations, including retrieving questions, answers, ...
Score of 0
2 answers
111 views
How to call a Python script from Octave using system()
I am trying to run a python script using Octave's system() function.
When I call the python script from terminal
source tabpfn_env/bin/activate
cd ~/tabpfn_env
python3 tabpfn_for_regression.py
the ...
Score of 0
1 answer
112 views
In the Python Socket Module, I am trying to send HTTP status codes to my client socket, but none work properly
In an assignment for my Computer Networks class, I am tasked with using sockets to receive HTTP packets. This is my current code:
import socket
from socket import *
import sys # In order to terminate ...
Score of -1
0 answers
71 views
Python asyncio raw TCP server on Fly.io drops external client connections while internal health checks pass [closed]
I am trying to establish a stable, raw TCP connection between a local Python-based coordinator and a Python receiver application hosted on Fly.io (App name: receiver-sin, region sin) listening on port ...
Score of -9
0 answers
129 views
Pygames and coins [closed]
Im making a flappy bird style game with pygames and I was wondering how do I code the coins mechanic?
I want to make it so there's a trajectory of coins for the user to collect. I imagine I need a ...
Score of 3
0 answers
145 views
How do I design a multi-purpose event handler without making it generic?
I am trying to design an event handler that can be used by different classes to manage events specific to that class. The event handler doesn't really need to know what type the events are as long as ...
Score of 1
1 answer
89 views
How to get unix-specific python modules working easily on Windows?
I'm currently trying to get https://github.com/cs01/pyxterm.js
working on Windows, I got it working on Linux but whenever I try Windows, I run into the issue that the `termios` module is not found. It ...