2,204,514 questions
Score of -2
1 answer
14 views
How do I build a parallel job runner in Python?
I want to write a small tool that reads a list of shell jobs from a config file, runs them in parallel with a limit on how many go at once, and prints a JSON report saying what passed and what failed. ...
Score of -1
2 answers
51 views
How to use isinstance on functools.cache cached classes?
After working on this answer, I have a cached class to have simple singleton behavior:
import functools
from dataclasses import dataclass
@functools.cache
@dataclass(frozen=True)
class Person:
...
Score of -1
1 answer
39 views
ImportError: cannot import name 'GradientBaseModelLLM' from 'llama_index.llms'
I am trying to run a script which uses GradientBaseLLM. Apparently the script was written by someone else couple of years back and I having tough time upgrading. I am importing
from llama_index.llms ...
Score of -6
0 answers
126 views
How to finish for loop that counts attempt on user input and then use the sum function to add all of the 5 nums from user input? [closed]
I'm asked to make a program that receives the 7 daily water consumption values.
I need to calculate the total of water consumed, the average daily consumption and the number of days that the water ...
Score of -4
0 answers
145 views
NumPy neural network from scratch for regression: is my implementation correct, and what hyperparameters or feature engineering should I try next? [closed]
I am implementing a 3-layer dense neural network from scratch using NumPy for a regression problem. I am not using TensorFlow, PyTorch, Keras, or any neural-network library because I want to ...
Score of 0
0 answers
88 views
Why does my Py-Shiny web app download an empty file?
I'm working on a web app that searches a database and returns the relevant information as CSV files in a Zip archive (company security policy prevents me from returning the information as tabs in an ...
Score of -3
0 answers
149 views
Creating a virtual monitor in code to transmit the processed image to an arduino [closed]
My goal is to create a virtual monitor / indirect display driver that can simulate a monitor on my pc, process the image (I will be running Atkinson Dithering to get a black/white output) and transmit ...
Score of 3
3 answers
139 views
Why does subprocess.run(cmd, shell=True) with shlex.quote() break on Windows?
I'm invoking a CLI tool from Python using:
import subprocess, shlex
cmd = f'somecli eval {shlex.quote(js_code)}'
subprocess.run(cmd, shell=True, capture_output=True, text=True)
This works correctly ...
Score of -4
0 answers
139 views
Python script download blocked by antivirus as a virus [closed]
I'm trying to download and run the decrypt_chrome_password.py script from this repository:
https://github.com/ohyicong/decrypt-chrome-passwords/blob/main/decrypt_chrome_password.py
However, I'm unable ...
Score of -2
4 answers
227 views
How to cleanly manage shifting player roles for a game of texas hold'em poker [closed]
I need advice on how to cleanly manage shifting player roles for a game of texas hold'em poker. I implemented a big blind, a small blind and a dealer role. These roles are important because they ...
Score of 0
1 answer
110 views
Power BI Python Visualization erroring out when it shouldn't
I am attempting to build a visualization testing some of Python's predictive analysis libraries and I am running into 2 issues. First, the dataset is larger than the apparent 150k row limit, so I was ...
Score of -4
1 answer
209 views
Finding digits in a string containing distinct digits [closed]
I'm finding out how to check for digits in a string; this is the code that I wrote:
import math
import cmath
a=set([1,2,3,4,5,6,7,8,9,0])
UNO=[]
for x in a:
for m in range(1,10**10):
for n ...
Score of 0
1 answer
90 views
IBKR ib_insync problem with placing stop limit orders in pre/post markets
On IBKR, and using ib_insync, I am having problems placing stop limit orders in pre/post markets. The first limit order order goes through smoothly, but the stop limit does not appear. On IBKR, the ...
Score of 2
1 answer
128 views
PyCharm type-hint warning: Member 'None' of 'Any | None' does not have attribute '__getitem__'
I have found a type-hint warning which I can't solve:
import shelve
with shelve.open("file.db") as f:
sess_data = f.get("xxx")
if sess_data:
username = sess_data[0]...
Score of -3
1 answer
168 views
Empty datetime() and type-hint errors [closed]
Any suggestions how to deal with these type-hint errors in PyCharm related to a datetime variable which initially starts off as None but then gets set at a later time. As far as I can tell datetime ...