QuestionId
int64
74.8M
79.8M
UserId
int64
56
29.4M
QuestionTitle
stringlengths
15
150
QuestionBody
stringlengths
40
40.3k
Tags
stringlengths
8
101
CreationDate
stringdate
2022-12-10 09:42:47
2025-11-01 19:08:18
AnswerCount
int64
0
44
UserExpertiseLevel
int64
301
888k
UserDisplayName
stringlengths
3
30
79,785,146
2,998,077
"Insert Python" in Excel's Formula section, to read another Excel file
<p>In Excel's Formula section, when using &quot;Insert Python&quot;, I want to read another Excel file as data frame.</p> <p>However as screenshot below, it seems wrong with the file path. I've try double slashes and backslashes too but it still doesn't work.</p> <p>What's the right way to write it?</p> <p><a href="htt...
<python><excel>
2025-10-08 06:49:13
1
9,496
Mark K
79,784,978
2,518,602
Importing a table from a webpage as a dataframe in Python
<p>I am trying to read in a specific table from the US Customs and Border Protection's Dashboard on Southwest Land Border Encounters as a dataframe.</p> <p>The url is: <a href="https://www.cbp.gov/newsroom/stats/southwest-land-border-encounters" rel="nofollow noreferrer">https://www.cbp.gov/newsroom/stats/southwest-lan...
<python><pandas><web-scraping>
2025-10-07 22:56:52
2
2,023
Ari
79,784,971
8,800,836
Wrap `jax.lax.fori_loop` to systematically override `upper<=lower` tracing behavior
<p>This is a follow-up to a <a href="https://stackoverflow.com/questions/79783857/jax-lax-fori-loop-with-equal-lower-and-upper-should-produce-no-iteration">previous question</a> about the <code>jax.lax.fori_loop</code> function, with a little bit of a challenge for you at the end.</p> <p>As described in the <a href="ht...
<python><for-loop><jax>
2025-10-07 22:34:07
1
539
Ben
79,784,882
1,747,834
Can PyArg_Parse* functions automatically convert strings to numbers?
<p>My script reads data from CSV-files and passes the rows to C code, which uses <code>PyArg_ParseTuple()</code> and/or <code>PyArg_ParseTupleAndKeywords()</code> to parse the arguments and then work on them.</p> <p>Some of the arguments are supposed to be strings, others -- numbers (integers and floating point). The e...
<python><c>
2025-10-07 19:41:59
0
4,246
Mikhail T.
79,784,865
344,286
How do I talk to Python in a subprocess?
<p>I would like to launch the Python REPL as a subprocess, but it doesn't appear to work:</p> <pre><code>import sys import subprocess p = subprocess.Popen([sys.executable], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) print(p) print('-') p.stdin.write(b'42\n') for line in p.stdout: print...
<python><subprocess>
2025-10-07 19:16:45
0
52,263
Wayne Werner
79,784,814
12,366,148
Deploying an Azure Python Webjob on Linux
<p>I have a <code>Linux</code> based <code>NodeJS</code> <code>Web App</code> resource on <code>Azure</code>.</p> <p>I want to deploy a <code>Python 3.12</code> based continuous <code>Web Job</code> under this Web App. I have added a <code>run.sh</code> which contains installing the <code>requirements.txt</code> and th...
<python><linux><azure><azure-web-app-service><azure-webjobs>
2025-10-07 18:01:25
1
524
CaptainCsaba
79,784,755
7,179,546
AppDynamics Python agent not working when migrating to EKS
<p>I have a Python application that uses AppDynamics, that works on Rancher. Everything is ok, no errors of any kind and the data is sent correctly by the agent.</p> <p>I'm migrating it now to EKS and the agent is not initializing anymore.</p> <p>I'm seeing in the logs <code>&quot;event&quot;: &quot;Exception in agent ...
<python><amazon-eks><appdynamics>
2025-10-07 16:31:42
0
737
Carabes
79,784,428
5,269,892
Openpyxl conditional formatting if cell among list values
<p>I would like to use <code>openpyxl</code> to create an Excel conditional formatting rule where cells are filled with a particular color, when the cell value matches an element among a hardcoded list of values. The hardcoded list should <em>not</em> be stored in the same Excel file. If possible, I would like to use a...
<python><excel><openpyxl><conditional-formatting>
2025-10-07 10:03:43
1
1,314
silence_of_the_lambdas
79,784,351
11,067,209
PyTorch + Optuna causes random segmentation fault inside TransformerEncoderLayer (PyTorch 2.6, CUDA 12)
<p>I'm running into a segmentation fault when training a Transformer model with PyTorch 2.6.0 and Optuna on CUDA (12.4). The exact same code used to work fine the issue appeared only after using Optuna.</p> <p>The crash happens deep inside the Transformer feed-forward block:</p> <pre><code>Fatal Python error: Segmentat...
<python><pytorch><attention-model><optuna>
2025-10-07 08:39:26
1
665
Angelo
79,784,113
21,540,734
How to correctly pass a filename with a single quote to ffmpeg's subtitles filter in Python?
<p>I'm writing a Python script using <code>subprocess</code> to hardcode subtitles onto a video. My code builds a complex filter graph for <code>ffmpeg</code>'s <code>-vf</code> argument, which includes burning in multiple layers of styled subtitles from an SRT file.</p> <p>The script works perfectly for most files, bu...
<python><ffmpeg><subprocess><escaping><command-line-arguments>
2025-10-06 22:13:06
4
425
phpjunkie
79,784,092
1,174,102
python virtualenv without losing apt-installed modules
<p>How can I create a python Virtual ENVironment (venv) such that the new venv has all of the python modules that are already installed on my system (with <code>apt</code>)?</p> <blockquote> <p>🛈 Note: It's much more secure to install python modules with <code>apt</code> than <code>pip</code>, due to the fact that <a ...
<python><debian><virtualenv><apt>
2025-10-06 21:29:32
1
2,923
Michael Altfield
79,783,857
8,800,836
`jax.lax.fori_loop` with equal `lower` and `upper` should produce no iteration, but body still executed
<p>I have a code that uses a bunch of <code>jax.lax.fori_loop</code>. The <a href="https://docs.jax.dev/en/latest/_autosummary/jax.lax.fori_loop.html" rel="nofollow noreferrer">documentation</a> of <code>fori_loop</code> says that &quot;setting upper &lt;= lower will produce no iterations&quot;. So I was naively expect...
<python><for-loop><jax>
2025-10-06 15:49:48
2
539
Ben
79,783,603
1,194,864
Websocket communication between server and client in python
<p>I would like to create a WebSocket communication between my personal laptop and a server. I have created the <code>client.py</code> and <code>server.py</code>, and they look as follows:</p> <p>Firstly, the server:</p> <pre><code>import asyncio import websockets async def handle_client(websocket): try: a...
<python><websocket>
2025-10-06 10:52:00
1
5,452
Jose Ramon
79,783,536
193,501
Class declaring error when the code is run, not sure what is the issue
<pre class="lang-py prettyprint-override"><code>class Dog: &quot;&quot;&quot;A simple attempt to model a dog.&quot;&quot;&quot; def __init__(self, name, age): &quot;&quot;&quot;Initialize name and age attributes.&quot;&quot;&quot; self.name = name self.age = age def sit(self): ...
<python><python-3.x><pycharm>
2025-10-06 09:49:48
1
2,163
anwarma
79,783,418
4,451,315
Is going from pyarrow chunkedarray to pyarrow table a zero-copy operation? How to check?
<p>If I have</p> <pre class="lang-py prettyprint-override"><code>import pyarrow as pa ca = pa.chunked_array([[1,2,3]]) </code></pre> <p>and then do</p> <pre><code>t = pa.table({'a': ca}) </code></pre> <p>then was the <code>pa.table</code> operation a zero-copy one?</p> <p>I would expect it to be, but is there any way ...
<python><pyarrow>
2025-10-06 06:57:45
0
11,062
ignoring_gravity
79,783,308
1,068,689
Jump to single link from Python traceback
<p>I have a Python file open in Visual Studio Code, and I run the file in the integrated terminal. When it hits a problem in my code (problems? in MY code???!), Python gives me the usual Traceback, starting with the first command it ran and ending with the line that triggered the bug. For example (and omitting some o...
<python><hyperlink><traceback>
2025-10-06 01:25:35
1
665
Mike Maxwell
79,783,307
1,719,931
uv is building projects without a [build-system] definition in the pyproject.toml
<p><a href="https://docs.astral.sh/uv/guides/package/#preparing-your-project-for-packaging" rel="nofollow noreferrer">The documentation for uv says</a>:</p> <blockquote> <p>If your project does not include a [build-system] definition in the pyproject.toml, uv will not build it by default.</p> </blockquote> <p>However:<...
<python><uv>
2025-10-06 01:19:28
0
5,202
robertspierre
79,783,245
11,540,076
Google Cloud Run error with OpenTelemetry CloudMonitoringMetricsExporter: "One or more points were written more frequently than the maximum sampl..."
<p><strong>Background</strong></p> <p>I have a containerized Python Flask application that is deployed on Google Cloud Run. I want to extract custom metrics from this app and send them to Google Cloud Monitoring.</p> <p>I followed the example in these two websites, using <code>CloudMonitoringMetricsExporter</code> from...
<python><google-cloud-run><open-telemetry><google-cloud-monitoring><google-cloud-metrics>
2025-10-05 22:27:06
0
485
Charlie Brown
79,783,219
859,191
TexStudio macro running python script but writing return string in message box
<p>I make my drawings in Krita while I write my report in TexStudio. In Krita I select part of the drawing and put it on the clipboard. I put my cursor in the .tex file at the desired position and run the macro.</p> <p>The macro takes the current file name and passes it to a python script. The latter converts the clipb...
<python><python-3.x><macros><latex>
2025-10-05 21:30:18
0
385
noste99
79,783,212
1,636,016
How to view the scene from a given pose (4x4 transformation matrix) in Matplotlib
<p>I'm trying to place the camera at a particular pose (given as a <code>4x4</code> transformation matrix) with the camera looking along the <code>+ve z-axis</code> in a <strong>Matplotlib 3D plot</strong>.</p> <p>There are a few reference poses and a dummy 3D model loaded for convenience.</p> <p>Below is the full work...
<python><matplotlib><matplotlib-3d>
2025-10-05 21:12:03
0
563
dibyendu
79,783,199
216,652
Weird errors while trying to connect to Mega.NZ from Python via https://pypi.org/project/mega.py/
<p>I'm trying to connect to Mega.NZ via module <a href="https://pypi.org/project/mega.py/" rel="nofollow noreferrer">https://pypi.org/project/mega.py/</a> with this code:</p> <pre><code>#!/usr/bin/env python3 from mega import Mega mega = Mega() m = mega.login(&quot;my mail&quot;, &quot;my pwd&quot;) details = m.get_u...
<python><python-asyncio>
2025-10-05 20:43:17
1
579
user216652
79,782,850
3,977,699
How to install Miniconda or switch Python version (3.12 → 3.11) in Modal Notebooks?
<p>I’m trying to run <code>Chatterbox TTS</code> on <code>Modal Notebooks</code>.</p> <p>Modal by default uses <code>Python 3.12</code>, but chatterbox requires dependencies (like <code>numpy==1.25.2</code>) that fail to build because <code>distutils</code> was removed in Python 3.12. So I have two possible solutions i...
<python><conda><virtual-environment><python-3.11><modal-com>
2025-10-05 07:39:00
0
1,691
Zulqarnain Jalil
79,782,403
2,659,307
Why does this Qt program that creates multiple QApplication objects crash unless I reset a dead local variable?
<h2>Program</h2> <p>If the following program is run on Windows with a single command-line argument, it will crash:</p> <pre class="lang-python prettyprint-override"><code># threading-crash.py &quot;&quot;&quot;Reproduce a crash involving Qt and threading&quot;&quot;&quot; from PyQt5 import QtCore import sys from thre...
<python><pyqt5><crash>
2025-10-04 09:58:04
1
13,707
Scott McPeak
79,782,389
607,407
Listing root child controls from uiautomation GetRootControl() stuck after the last item for 3+ minutes
<p>I am trying to play around with <code>uiautomation</code> on windows. As a first test, I wanted to list everything in root to investigate what is worth recursing into.</p> <p>This is my script:</p> <pre><code>import uiautomation as uia import time class AccessibilityReader: def __init__(self): self.root...
<python><ui-automation><microsoft-ui-automation>
2025-10-04 09:17:42
1
53,877
Tomáš Zato
79,782,339
703,421
pyexiv2 blocks on some images
<p>I use pyexiv2 (2.15.4, python 3.8, Windows 8.0) to read EXIF and IPTC from my JPEGs. On very few images (1 on 5000), it blocks and hangs python. My code is :</p> <pre><code>from pyexiv2 import Image ima = Image(path_ima) </code></pre> <ul> <li>There is no accentued characters in IPTC, EXIF of path_ima.</li> <li>The ...
<python><freeze><pyexiv2>
2025-10-04 06:46:52
0
2,279
Eric H.
79,782,328
395,857
How can I use web search with GPT on Azure using Python?
<p>I want to use web search when calling GPT on Azure using Python.</p> <p>I can call GPT on Azure using Python as follows:</p> <pre><code>import os from openai import AzureOpenAI endpoint = &quot;https://somewhere.openai.azure.com/&quot; model_name = &quot;gpt5&quot; deployment = &quot;gpt5&quot; subscription_key = ...
<python><azure><azure-cognitive-services><web-search><gpt-5>
2025-10-04 05:54:55
1
84,585
Franck Dernoncourt
79,782,321
6,329,284
Multi-file and multi-threaded copy in python affects network speed
<p>Im working on a small program where I have three threads with each a task to run: copy a file from A to B using a bash script. One thread copies a 100GB file, then another 2x a 10GB file.</p> <p>The 100GB file copy starts then with a delay I start the copy of the first 10GB file when that is done the last 10GB copy ...
<python><performance>
2025-10-04 05:36:48
1
1,340
zwep
79,782,313
8,384,910
Display all compatible versions of a package
<p>The <code>tensorflow-io</code> package drops wheels for Windows after <code>0.31.0</code>, but only newer versions have wheels for Apple Silicon.</p> <p>I am using features that still work across versions, so I want to pin the package to different versions for different platforms/architectures.</p> <p>For example, i...
<python><uv>
2025-10-04 05:20:31
0
9,414
Richie Bendall
79,782,307
8,384,910
What does the uvw command do?
<p>When I install <code>uv</code> though winget, the <code>uv</code>, <code>uvx</code> and <code>uvw</code> aliases get added.</p> <p>I know that <code>uvx</code> is an alias for <code>uv tool run</code>, but what is <code>uvw</code> an alias for?</p>
<python><uv>
2025-10-04 04:48:22
1
9,414
Richie Bendall
79,782,279
3,151,415
Not able to call tool in Agno Agent run mode
<p>I am trying the example mentioned in the <a href="https://docs.agno.com/introduction/quickstart" rel="nofollow noreferrer">Agno docs</a>. I am running it normally instead of the AgentOs mode. In agentOs mode it’s able to call the mcp server and give right answer.</p> <pre><code>from agno.agent import Agent from agno...
<python><agno>
2025-10-04 03:20:10
1
6,248
garg10may
79,782,221
4,887,159
Error while deploying, but not in local: "crewai Failed to upsert documents: "Expected IDs to be unique, found 28 Duplicate IDs"
<p>When I initialize a Crew in Azure, I get an error:</p> <blockquote> <p>crewai Failed to upsert documents: &quot;Expected IDs to be unique, found 28 Duplicate IDs&quot;</p> </blockquote> <p>followed by lots of uuids.</p> <pre><code>from crewai import Agent, Crew, Process, Task from crewai.project import CrewBase, age...
<python><large-language-model><agent><crewai>
2025-10-03 23:15:59
1
3,994
Ray
79,782,149
12,016,688
Does flask dev server normalize paths?
<p>I was playing a CTF which was about path traversal. The server code was like below:</p> <pre class="lang-py prettyprint-override"><code>import flask import os app = flask.Flask(__name__) @app.route(&quot;/docs/&lt;path:path&gt;&quot;, methods=[&quot;GET&quot;]) def challenge(path=&quot;index.html&quot;): prin...
<python><flask><ctf><path-traversal>
2025-10-03 20:40:28
1
2,470
Amir reza Riahi
79,781,841
2,435,421
boto3 S3 SSL validation failed in docker swarm but working locally
<p>I'm trying to upload a file using boto3 to a S3 provider. With the exact same environment variables and the same container. It's fully working locally but when deployed inside my swarm I always have this error:</p> <pre><code>botocore.exceptions.SSLError: SSL validation failed for https://s3.sbg.io.cloud.ovh.net/MYB...
<python><docker><boto3>
2025-10-03 13:56:49
0
1,264
Splinteer
79,781,778
1,147,321
Use decorator to remove await prefix
<p>I am working with Asyncio in an app I am making. However, I find it daunting to prefix my function calls with await.</p> <p>So I want to encapsulate it in a decorator that adds the wait to the function call.</p> <pre><code>def await_wrap(async_func): def wrapper(*args, **kwargs): return await async_func(...
<python><python-asyncio>
2025-10-03 12:38:15
1
2,167
Ephreal
79,781,489
12,030,613
Deploying a Python HTTP function to Google Cloud run from source
<p>I'm trying to deploy a Python HTTP function to Google Cloud Run from source. However, I'm facing a weird issue, where deploying it from source somehow creates a broken deployment, but when (re-) deploying the already deployed source code through the Cloud console buttons, it starts working. This is what I'm doing:</...
<python><google-cloud-platform><google-cloud-run><google-cloud-deploy>
2025-10-03 06:26:35
1
351
unie
79,781,331
312,140
How to plot the smooth graph on matplotlib like MS-Excel?
<p>MS-Excel can generate smooth line graphs even with a small number of data points. How can I generate similar graphs using matplotlib? I have tried several ways like fitting the polynomials with different degrees, but the results aren't as good. I do not want to have the pointy corners but instead I want to convert t...
<python><excel><matplotlib>
2025-10-02 22:22:10
1
3,031
Mahdi Amrollahi
79,781,320
216,652
Weird failure in Selenium
<p>I'm trying to run this script</p> <pre><code>#!/usr/bin/env python3 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from ...
<python><python-3.x><google-chrome><selenium-webdriver>
2025-10-02 21:57:19
1
579
user216652
79,781,281
6,630,397
Unable to load an hdf5 model file in TensorFlow / Keras
<p>I was given an hdf5 model file that was build with tensorflow / keras. Training data is no more available.</p> <p>Note: all Python code snippets shown hereunder are run against Python 3.9.23 inside a Dockerized Debian 13 (trixie) environment:</p> <pre class="lang-bash prettyprint-override"><code># python3 Python 3.9...
<python><tensorflow><keras><hdf5>
2025-10-02 20:35:57
0
8,371
swiss_knight
79,781,244
8,609,461
LangFuse: Using `CallbackHandler` with custom OpenAI Base URL throws SSL Error
<p>As I am upgrading my Langfuse Python SDK to the latest version 3.6.1, I am updating the <code>CallbackHandler</code> for enabling tracing in my LangGraph solution. I use my own OpenAI BaseUrl and hence created a <code>httpx</code> client with my certs. But, I received the following error. This was working with the p...
<python><langgraph>
2025-10-02 19:32:41
0
436
Parth Sekar
79,781,221
259,543
Variadic tuple type parameter
<p>I am trying to annotate a function which receives a tuple of types, and returns a value of one of the provided types.</p> <p>For example:</p> <pre><code>@overload def func[T1](types: tuple[type[T1]]) -&gt; T1: ... @overload def func[T1, T2](types: tuple[type[T1], type[T2]]) -&gt; T1 | T2: ... @overload def func[T1, ...
<python><python-typing>
2025-10-02 18:56:44
2
5,252
alecov
79,781,203
3,173,858
How to iterate over python dictionary in C#
<p>I am trying to call a C# logging library from Python. I want to support logging complex Python objects and dictionaries from the C# library. I'm using pythonnet 3.0.5.</p> <p>When I pass the dictionary to C#, the Python code looks like this:</p> <pre><code>import clr clr.AddReference(&quot;Logging&quot;) from Logg...
<python><c#><python.net>
2025-10-02 18:34:05
1
1,581
Bryce Wagner
79,781,113
243,031
Gunicorn with worker 1 not able to call local API
<p>I have flask app, which we are running using gunicorn.</p> <p>App structure.</p> <pre><code>% tree your_flask_app your_flask_app ├── __init__.py ├── app.py └── routes ├── __init__.py ├── data.py └── shared.py </code></pre> <p><strong>your_flask_app/app.py</strong></p> <pre><code>from flask import Flask f...
<python><rest><flask><timeout><gunicorn>
2025-10-02 16:03:44
1
21,411
NPatel
79,780,975
6,251,742
skip_dfs=True doesn't skip DFS
<p>Using Python package <a href="https://github.com/jborean93/smbprotocol" rel="nofollow noreferrer">smbprotocol</a>, I have an issue with DFS with a specific server that have DFS enabled.</p> <p>The error:</p> <pre><code> smbclient.listdir(folder_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File &quot;/app/venv/lib/pyt...
<python><smb>
2025-10-02 13:40:23
0
4,033
Dorian Turba
79,780,819
2,659,307
How do I make a Qt5 queued connection in a way that mypy will accept?
<p>Using Python and Qt5, I can make a normal signal connection like this:</p> <pre><code> def clicked() -&gt; None: print(&quot;clicked&quot;) btn = QtWidgets.QPushButton(&quot;Button&quot;, window) btn.clicked.connect(clicked) </code></pre> <p>However, if I try to arrange for the connection to use a <a href=...
<python><pyqt5><python-typing><mypy>
2025-10-02 10:32:24
0
13,707
Scott McPeak
79,780,815
2,287,458
Forward fill using values from rows that match a condition in Polars
<p>I have this dataframe:</p> <pre class="lang-py prettyprint-override"><code>import polars as pl df = pl.DataFrame({'value': [1,2,3,4,5,None,None], 'flag': [0,1,1,1,0,0,0]}) </code></pre> <pre><code>┌───────┬──────┐ │ value ┆ flag │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞═══════╪══════╡ │ 1 ┆ 0 │ │ 2 ┆ 1 │ ...
<python><dataframe><python-polars>
2025-10-02 10:25:59
3
3,591
Phil-ZXX
79,780,798
26,674,420
How to select joined columns with structure like namespaces (a.col1, b.col2)?
<p>I am working to migrate from PySpark to Polars. In PySpark I often use aliases on dataframes so I can clearly see which columns come from which side of a join. I'd like to get similarly readable code in Polars. Conceptually, I want something like this (non-working) code.</p> <pre class="lang-py prettyprint-override"...
<python><dataframe><python-polars>
2025-10-02 10:07:03
1
376
Arend-Jan Tissing
79,780,792
395,857
How can I update the capacity of a finetuned GPT model on Azure using Python?
<p>I want to update the capacity of a finetuned GPT model on Azure. How can I do so in Python?</p> <p>The following code used to work a few months ago (it used to take a few seconds to update the capacity) but now it does not update the capacity anymore. No idea why. It requires a token generated via <a href="https://l...
<python><azure><azure-openai><gpt-4>
2025-10-02 10:00:53
1
84,585
Franck Dernoncourt
79,780,657
538,256
vector field vortices location
<p>I'm using matplotlib's quiver to overimpose a vector field on an image:</p> <p>by this code (I use two images imgT and imgL to obtain the horizontal and vertical vector components):</p> <pre><code>gd=1 # sampling sy,sx = imgT.shape[:2] imgTscaled = resize(imgT, (int(sy/gd), int(sx/gd))) imgLscaled = resize(imgL, (...
<python><scipy>
2025-10-02 06:21:08
1
4,004
alessandro
79,780,565
2,056,201
Python cannot install torch
<p>Why can I not Install Torch, I am using python 3.10.10 I donts care to be in a virtual environment, Im using a virtual OS.</p> <p>Why does this stupid tool not let me install torch</p> <blockquote> <p>D:&gt;pip install torch Defaulting to user installation because normal site-packages is not writeable ERROR: Could n...
<python><pip>
2025-10-02 00:53:13
1
3,706
Mich
79,780,334
1,886,914
How can I create a Python venv within a Bash script and then activate it immediately, all from a VS Code profile's settings.json?
<p>I have this profile <code>settings.json</code>:</p> <pre class="lang-json prettyprint-override"><code>{ &quot;terminal.integrated.profiles.osx&quot;: { &quot;python-venv&quot;: { &quot;path&quot;: &quot;/opt/homebrew/bin/bash&quot;, &quot;args&quot;: [ &quot;-l&quo...
<python><bash><visual-studio-code><python-venv>
2025-10-01 17:54:33
2
931
Kenny83
79,780,282
2,056,201
Installing Onnx package broke all python dependencies
<p>I followed all of the instructions in this video and installed al the the proper packages on top of Python 3.10.0</p> <p><a href="https://www.youtube.com/watch?v=v1d7SinTzEY&amp;t=1s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=v1d7SinTzEY&amp;t=1s</a></p> <p><code>pip install torch torchaudio torchvis...
<python><unity-game-engine><pip><ml-agent>
2025-10-01 16:21:29
0
3,706
Mich
79,780,256
5,986,907
Overhead of instantiating a flax model
<p>Is it expensive to keep recreating a Flax network, such as</p> <pre><code>class QNetwork(nn.Module): dim: int @nn.compact def __call__(self, x): x = nn.Dense(120)(x) x = nn.relu(x) x = nn.Dense(84)(x) x = nn.relu(x) x = nn.Dense(self.dim)(x) return x q = ...
<python><jax><flax>
2025-10-01 15:47:24
0
8,082
joel
79,780,187
5,552,507
Holoviz panel notification width
<p>Holoviz panel notification width is too small for more than a few words so my messages get cut.</p> <p><strong>Can I wrap text and/or increase default width to e.g. 600 px?</strong></p> <h3>What I tested so far:</h3> <p>In <a href="https://panel.holoviz.org/reference/global/Notifications.html" rel="nofollow noreferr...
<python><css><panel><holoviz>
2025-10-01 14:42:10
1
307
PiWi
79,780,080
11,328,614
telnetlib3, StreamReader/Writer vs. TelnetReader/Writer
<p>I'm trying to type hint my <code>telnetlib3</code> client. However, I have some utility code which should not depend on <code>telnet</code>. It should be able to deal with <code>asyncio</code> <code>StreamReader</code>/<code>Writer</code> in common.</p> <p>Now, if I pass a <code>TelnetReader</code>/<code>Writer</cod...
<python><python-typing><telnetlib3>
2025-10-01 12:57:09
0
1,132
Wör Du Schnaffzig
79,779,946
5,378,816
python REPL: is it possible to combine -i and -m asyncio?
<p>I was trying to start the asyncio REPL (<code>python -m asyncio</code>) and to execute a script before starting the interactive REPL (<code>python -i ./script.py</code>). I tried re-ordering of options, the end-of-options symbol <code>--</code>, but I'm afraid it cannot be done.</p> <p>Is it possible to execute a co...
<python><python-asyncio>
2025-10-01 10:55:31
1
17,998
VPfB
79,779,897
2,126,910
Get AWS API Gateway API keys that don't match nameQuery parameter in get_api_keys() boto3 AWS SDK
<p>As the title says, I can get all API keys in API Gateway that start with the contents of <code>nameQuery</code>, but is it possible to get all API keys that <strong>don't</strong> match nameQuery?</p> <p>I'm looking to filter out some API keys that have a set prefix (e.g. <code>prefix-</code>). I'm currently using t...
<python><amazon-web-services><boto3><aws-api-gateway>
2025-10-01 10:05:17
1
706
philMarius
79,779,732
20,298,890
Python gdal open layer from bytes
<p><strong>I need to perform a conversion from a FlatGeoBuf file that I read as bytes from an http request to a GeoJSON file.</strong></p> <p>I know that I could save the .fgb on disk, open it with ogr, and then I have a function to export an OGR layer to GeoJSON.</p> <p>But I would like to <strong>avoid writing on dis...
<python><gdal><ogr>
2025-10-01 07:06:58
1
503
marting
79,779,724
2,218,321
Order of execution in FastAPI async generators
<p>This is the code</p> <pre><code>@router.post(&quot;/tel/verify-otp&quot;, summary=&quot;Verify OTP and update user tel number&quot; ) async def verify_tel_otp( command: UpdateTelCommand = Body(...), handler: VerifyTelOtpHandler = Depends(get_verify_tel_otp_handler), ): a...
<python><fastapi><contextmanager>
2025-10-01 06:53:41
1
2,189
M a m a D
79,779,468
1,361,802
How to use Temporal pydantic_data_converter while not causing a workflow validation failure?
<p>My understanding is that to get the <a href="https://python.temporal.io/temporalio.contrib.pydantic.html" rel="nofollow noreferrer"><code>pydantic_data_converter</code></a> to auto convert outputs, you need to pass a function reference, i.e.</p> <p>This properly returns a TestModel</p> <pre><code> result: Tes...
<python><pydantic><deterministic><temporal-workflow>
2025-09-30 19:43:29
1
8,643
wonton
79,779,432
3,067,485
How can I run airflow db clean command using BashOperator with Airlfow 3+
<p>I run airflow using official <a href="https://airflow.apache.org/docs/apache-airflow/3.1.0/docker-compose.yaml" rel="nofollow noreferrer">docker compose file</a>.</p> <p>I would like to run a simple command with Airflow BashOperator to clean my logs:</p> <pre><code> clean_database = BashOperator( task_id=...
<python><airflow>
2025-09-30 18:49:54
1
11,564
jlandercy
79,779,220
1,837,122
Enabling Delta Table checkpointing when using polars write_delta()
<p>I am using polars.df.write_delta() to initially create, and subsequently append to, Delta Tables in Microsoft Fabric OneLake storage, via a Fabric python notebook.</p> <p>Having had a production process up and running for some time, I notice that the most frequently-updated tables are showing a warning/error in the ...
<python><python-polars><delta-lake><microsoft-fabric><delta-rs>
2025-09-30 14:21:18
0
438
Stuart J Cuthbertson
79,779,098
7,179,546
lxml package doesn't work after upgrading to Python 3.9
<p>I have a project written in Python 3.8 and I'm trying to upgrade it to 3.9 (and higher, if it's possible; I actually want to upgrade to Python 3.13, but I'm going step by step).</p> <p>I have this <code>Pipfile</code>:</p> <pre class="lang-toml prettyprint-override"><code>[[source]] url = &quot;https://pypi.org/simp...
<python><pipenv>
2025-09-30 12:33:22
0
737
Carabes
79,779,034
5,704,664
structlog enforce Wrapped logger type with mypy
<p>I wanted to override the structlog logger for the whole application, by doing this:</p> <pre><code>import enum from collections.abc import Iterable import structlog from structlog.typing import Processor from typing_extensions import override class WarningCode(enum.Enum): ... class WrappedLogger(structlog.s...
<python><logging><python-typing><mypy><structlog>
2025-09-30 11:26:22
0
2,018
comonadd
79,778,984
548,846
nautilus trader backtest stops incomplete without any error
<p>I have the following Nautilus Trader backtest script. It runs, but stops midway at random bars without showing any error. My dataset has over 3,000 bars, but the backtest usually halts somewhere between bars 350 and 400. Could you suggest if I might be doing something wrong? I’m new to Nautilus Trader.</p> <pre><cod...
<python><back-testing>
2025-09-30 10:14:00
0
1,237
Saravanan
79,778,680
3,294,994
Type hinting for a generator function that asserts sortedness
<p>I'd like to type-hint a &quot;pass-through&quot; generator that checks for sortedness and raises otherwise:</p> <pre class="lang-py prettyprint-override"><code>def assert_sorted(iterable, key=None): first = True for item in iterable: if first: prev_key = key(item) if key else item ...
<python><python-typing><comparable>
2025-09-30 03:44:43
1
846
obk
79,778,453
8,901,102
Override dependency in dev environment
<p>I have a Python project where I develop an external package in parallel.</p> <p>When it is deployed I would like to point the install to a set version in the git repo, but for development I would like to have a editable local install.</p> <p>This is my <code>pyproject.toml</code>:</p> <pre class="lang-toml prettypri...
<python><uv>
2025-09-29 18:47:42
0
927
pask
79,778,443
7,240,233
How to transfer Python variables from one Flask view to another?
<p>I am working on a Flask app constructed as follows:</p> <ol> <li>The starting HTML template, controlled by a view, displays a text box, where the user can enter a SQL request to request a SQLite database connected to the app.</li> <li>In a second view, the request is executed, then the result is converted into a pan...
<python><pandas><flask>
2025-09-29 18:41:44
1
721
Micawber
79,778,333
5,118,421
Assertion failed: (self->u.Consumer.rkqu) for confluent python kafka
<p>Try the confluent kafka base example</p> <pre><code>from confluent_kafka import Consumer c = Consumer({ 'bootstrap.servers': 'localhost:9092', 'group.id': None, 'auto.offset.reset': 'earliest' }) c.subscribe(['my_topic']) while True: msg = c.poll(1.0) if msg is None: continue if m...
<python><apache-kafka><confluent-kafka-python>
2025-09-29 16:05:08
0
1,407
Irina
79,778,328
4,891,461
Python not running in VS Code using WSL remote
<p><strong>Environment</strong></p> <pre><code>cd workspace/playground python3 -m venv . source bin/activate pip install pandas pip install pycorp2 </code></pre> <p><strong>Running</strong></p> <pre><code>cd workspace/playground source bin/activate py playground.py </code></pre> <p>I have a Python script that uses Pand...
<python><visual-studio-code>
2025-09-29 15:58:26
2
336
quickblueblur
79,778,060
2,989,330
Use msgspec to (de-)serialize Python objects without hard-coding serialization library in data classes
<p>I want to use JSON to serialize and deserialize a complex Python object. This Python object contains other Python objects that may be implementations of a protocol or descend from a common abstract class.</p> <p>My naive implementation is as follows:</p> <pre><code>class A(Protocol): def f(self): ... @d...
<python><serialization><deserialization><msgspec>
2025-09-29 11:39:16
1
3,203
Green 绿色
79,777,976
18,910,865
PyCharm "view as DataFrame" shows nothing for polars DataFrames
<p>Basically the title. Using <code>PyCharm 2023.3.3</code> I'm not able to see the data of polars DataFrames.</p> <p>As an example, I've a simple DataFrame like this:</p> <pre><code>print(ids_df) shape: (1, 4) ┌─────────────────────────────────┬────────────────────┬────────────────────────────┬───────┐ │ uuid ...
<python><debugging><pycharm><python-polars><polars>
2025-09-29 09:56:54
0
522
Nauel
79,777,919
3,760,519
Is there a way to complement / supplement a stubs package with additional type information in a stubs file?
<p>I am using pyright in strict mode and I would like to avoid littering my code with exceptions telling pyright to ignore some line. I have been using my own stub file to great success in the case of dependencies that do not provide their own stub information. However, in the case of pandas, and even using pandas-stub...
<python><pandas><pyright>
2025-09-29 08:57:07
0
2,406
Chechy Levas
79,777,583
7,706,098
How to use matplotlib.axes.Axes.violin?
<p>I have been looking for an example of usage of matplotlib.axes.Axes.violin(). I am not looking for an example of matplotlib.axes.Axes.violinplot(). I cannot find one example anywhere. According to the <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.violin.html" rel="nofollow noreferrer">matpl...
<python><matplotlib>
2025-09-28 20:42:20
0
301
Redshoe
79,777,378
5,023,268
Python command/event registration pattern
<p>I am working on my first service using ddd.</p> <p>My domain layer looks simillar to:</p> <pre><code>/ domain /A /aggregateA.py -&gt; fires an EventA /aggregateARepository.py /B /aggregateB.py /aggregateAService.py &lt;-- Implements an event handler that listens to EventA </code></pre> <p>S...
<python><event-handling><domain-driven-design>
2025-09-28 14:35:18
0
591
AF_cpp
79,777,358
2,243,490
Tables are not getting create with dynamic schema name
<p>I have the following SQLAlchemy model definition and function to create the table.<br /> I am using postgresDB. But the tables are never getting created.</p> <h5>Model Definition</h5> <pre><code>class User(Base): __tablename__ = &quot;users&quot; id = Column(Integer, primary_key=True, autoincrement=True) ...
<python><python-3.x><sqlalchemy>
2025-09-28 13:41:35
1
1,886
Dinesh
79,777,273
560,065
Networkx - how to use full canvas space
<p>When generating a diagram with networkx and pyplot, the diagram is squashed in the middle with lots of empty white space around it.</p> <pre class="lang-py prettyprint-override"><code>import networkx as nx import matplotlib.pyplot as plt print(f&quot;Building graph...&quot;) g = nx.Graph() &quot;&quot;&quot; for lo...
<python><matplotlib><graph><networkx>
2025-09-28 10:47:14
1
11,150
Baldrick
79,777,255
5,061,637
If I build a static-linked ELF binary from a Python project, can I run it on every Linux distribution?
<p>I'm working on converting a Python package to a more efficient version by porting it from Python to C++ using pybind11.</p> <p>The performances are really better, but now I have to distribute it.</p> <p>It's an &quot;internal product&quot;, only used by my company, so we don't have licence issues, but it can be used...
<python><c++><linux><static-linking>
2025-09-28 10:14:11
2
1,182
Aurelien
79,777,009
1,779,973
How can I enable context-aware indentation when pasting Python code in VSCode?
<p>I'm trying to replicate a feature from PyCharm in Visual Studio Code and running into trouble.</p> <p>In <strong>PyCharm</strong>, when I copy a block of Python code and paste it inside a function, class, or loop, the IDE automatically adjusts the indentation to match the surrounding context. This behavior—often ref...
<python><visual-studio-code><pycharm><vscode-extensions>
2025-09-27 21:15:17
1
536
Ido
79,776,967
2,774,885
is there a way to combine replacing byte-strings with regex strings?
<p>I have some (working) code that searches for and modifies text within a PDF file.</p> <p>it takes a list of &quot;strings&quot; that I want to find, and replaces each with a string of spaces that is the same length as the found string. (you can't just remove the strings , because that breaks the re-encoding of the ...
<python><regex>
2025-09-27 19:51:05
1
1,028
ljwobker
79,776,925
7,706,098
How to save violin plot object as npy or npz files
<p>I am plotting multiple violin plots for a large dataset and it takes so long to generate one figure. I would like to save the violin plotting objects as npy or npz, and plot them separately. Is this possible? If so, how do I go about it?</p> <p>EDIT</p> <p>Here is the full code that I am working with.</p> <pre><code...
<python><numpy><matplotlib>
2025-09-27 17:52:15
1
301
Redshoe
79,776,858
13,848,874
Multimodel for image captioning with CNN and LSTM over flickr30k does not learn. How to fuse image features and word embeddings?
<p>I'm working on an image captioning project using a simple CNN + LSTM architecture, as required by the course I'm studying. The full code is available <a href="https://github.com/mahdavis2024/CS-projects/blob/main/step12/V1_image_captioning.ipynb" rel="nofollow noreferrer">here on GitHub</a> (<strong>note</strong>: s...
<python><tensorflow><keras><deep-learning><lstm>
2025-09-27 15:34:13
0
473
Malihe Mahdavi sefat
79,776,764
1,999,585
How can I fix the "Calling format_html() without passing args or kwargs is deprecated." in PyCharm?
<p>I have the following code:</p> <pre><code>def _demo_preview_message(request): if not getattr(settings, 'IS_DEMO', False): return last = DemoEmail.objects.order_by('-id').first() if last: messages.success( request=request, message=format_html(&quot;Email queued (dem...
<python><django><pycharm>
2025-09-27 12:36:29
2
2,424
Bogdan Doicin
79,776,615
5,705,943
Find percentage of grouped variable in a Dataframe in pandas
<p>I have a dataframe where column 1 has values like <code>'A', 'B'</code> etc (categorical variable) and column 2 (also a nominal categorical variable) has values like <code>'city 1', 'city 2'</code> etc. I want to group by column 1 and find out percentage of <code>'city 1'</code> in each category of column 1. How can...
<python><pandas><dataframe>
2025-09-27 08:21:25
3
970
user9026
79,776,360
913,098
Pycharm 2025.2 pro WSL interpreter not running
<ol> <li>I have created a venv interpreter using <code>python -m venv venv</code> and another using poetry</li> <li>I pointed pycharm to these interpreters (separately), and it claims to see them</li> <li>Then, running the simplest program <code>print(&quot;hello&quot;)</code>, hangs.</li> </ol> <p><em>I appologize for...
<python><pycharm><python-venv>
2025-09-26 20:26:30
1
28,697
Gulzar
79,776,143
2,287,458
Find nearest / closest value to subset of values in a Polars dataframe
<p>I have this dataframe</p> <pre class="lang-py prettyprint-override"><code>import polars as pl df = pl.from_repr(&quot;&quot;&quot; ┌────────────┬──────┐ │ date ┆ ME │ │ --- ┆ --- │ │ date ┆ i64 │ ╞════════════╪══════╡ │ 2027-11-25 ┆ 0 │ │ 2027-11-26 ┆ 0 │ │ 2027-11-29 ┆ 0 │ │ 2027-11-...
<python><dataframe><python-polars><asof-join>
2025-09-26 15:47:15
1
3,591
Phil-ZXX
79,776,081
10,491,012
lxml: QName value does not resolve to a(n) attribute group definition
<p>I get the following error, while trying to validate XML using a schema:</p> <blockquote> <p>lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}attributeGroup', attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}specialAttrs' does not resolve to a(n) attribute group defini...
<python><xml><xsd><schema><lxml>
2025-09-26 14:45:01
1
386
Bogdan Prădatu
79,775,968
8,800,836
Calculating higher-order derivatives for functions that are defined by a differential equation using `jax.experimental.jet`
<p>I have a matrix function U(t) that is defined by the differential equation, U'(t) = -i H(t)U(t), where H(t) is a known function of time.</p> <p>I already have the value U(t) at some specific time t, and thus I also have the value U'(t). I already know all the derivatives of H(t).</p> <p>I would like to use <code>jax...
<python><jax><automatic-differentiation>
2025-09-26 12:57:09
0
539
Ben
79,775,693
6,681,932
skforecast insample predictions
<p>Using skforecast, it's straightforward to perform out-of-sample predictions starting from the dates in the <code>last_window_.index</code> of a <code>ForecasterRecursive</code> object. However, I’m unable to find a clear method for generating in-sample predictions with a <code>ForecasterRecursive</code> model.</p> <...
<python><validation><forecasting><training-data>
2025-09-26 09:15:31
1
478
PeCaDe
79,775,683
14,282,714
Error: subprocess-exited-with-error installing vllm
<p>I'm trying to install the <code>vllm</code> package using pip. It returns an error:</p> <pre><code>pip install vllm Collecting vllm Using cached vllm-0.10.2.tar.gz (10.9 MB) Installing build dependencies ... error error: subprocess-exited-with-error × pip subprocess to install build dep...
<python><vllm>
2025-09-26 09:06:58
0
42,724
Quinten
79,775,241
6,362,595
Exclude pylint too few public method error
<p>In <code>marshmallow</code> you can use the custom <code>Meta</code> attribute to customize a schema's behavior:</p> <pre><code>from marshmallow import Schema class MySchema(Schema): class Meta: fields = (&quot;id&quot;, &quot;email&quot;, &quot;date_created&quot;) exclude = (&quot;password&quo...
<python><pylint><marshmallow>
2025-09-25 19:31:10
2
921
fgoudra
79,775,202
14,055,279
Android TV Remote v2 Protocol: Backspace Not Working When Sending Single Characters
<p>I'm implementing an Android TV Remote v2 protocol in Flutter/Dart. My goal is to send keyboard input from a mobile app to the TV. For most characters, everything works fine. However, the backspace key doesn't work when I send characters one at a time.</p> <p>Here is my current Flutter TextField implementation:</p> <...
<python><android><dart><android-tv><payload>
2025-09-25 18:40:11
0
623
shakti goyal
79,775,050
1,509,264
Filtering Django QuerySet after using a Window function
<p>For a simple model:</p> <pre class="lang-py prettyprint-override"><code>from django.db.models import CharField, Model, PositiveIntegerField class Example(Model): category = CharField(max_length=20, null=False, blank=False) version = PositiveIntegerField(null=False, blank=False) class Meta: uniq...
<python><django><greatest-n-per-group>
2025-09-25 15:38:47
2
172,539
MT0
79,774,532
396,373
Django Celery Beat 2.8.0 sending many-per-hour tasks but not daily tasks
<p>This is a really weird situation. Tasks that are scheduled to run every several minutes every hour of the day (e.g. &quot;*/20 * * * *&quot;) are being sent to Celery (with entries in Celery Beat's log) and Celery is running them. Tasks that are to be run once per day (e.g. &quot;15 11 * * *&quot;) are not happening...
<python><django><celerybeat><django-celery-beat>
2025-09-25 07:59:16
1
12,777
Steve Jorgensen
79,774,439
7,683,041
Cannot import QtWebEngineWidgets in PySide6 on a docker Windows container
<p>I have a python PySide6 program that I want to compile and test on a container. The program runs on Windows, so I have a Windows container:</p> <pre><code>FROM winamd64/python:3.13.5-windowsservercore # .. install choco, git bash, vcredist2017, visualstudio2022buildtools, visualstudio2022-workload-vctools, python3 -...
<python><docker><pyside6><qtwebengine><windows-container>
2025-09-25 06:36:57
0
1,310
PJ127
79,774,346
81,120
How to extract & coalesce deeply nested values that may not exist?
<p>I'm trying to extract some data from deeply nested JSON - this works:</p> <pre><code>lf.with_columns( [ pl.coalesce( [ pl.col(&quot;a&quot;), pl.col(&quot;some_struct&quot;).str.json_path_match(&quot;$.foo&quot;), pl.col(&quot;some_struct&quot;)...
<python><dataframe><python-polars>
2025-09-25 04:02:01
1
598
dsully
79,774,326
2,081,568
Python openapi-python-client runtime error when deserializing
<p>I am attempting to consume the API at <a href="https://api.oemserver.com/swagger/index.html" rel="nofollow noreferrer">https://api.oemserver.com/swagger/index.html</a></p> <p>I have run the tool at <a href="https://github.com/openapi-generators/openapi-python-client" rel="nofollow noreferrer">https://github.com/open...
<python><python-3.x><openapi-generator>
2025-09-25 02:53:01
1
1,111
Hecatonchires
79,774,301
1,564,070
VS Code Python import not resolving
<p>I'm configuring a new Windows 11 development environment to support multiple projects and multiple shared packages. The test program runs as expected, however, the import statement flags LibHB as an unresolved import, and autocomplete does not work for the library.</p> <p>The directory structure is:</p> <pre><code>P...
<python><visual-studio-code>
2025-09-25 01:30:44
2
401
WV_Mapper
79,774,289
4,930,744
Running flake8 linter in JupyterLab, getting E303 false positives
<p>My goal is to have a PEP8 linter that highlights style violations while I'm editing Python notebooks on my Windows 10 computer.</p> <p>I've installed pylsp as a JupyterLab extension. It's working, except that I get an error &quot;E303 too many blank lines&quot; on the first line of every code cell that follows a mar...
<python><jupyter-notebook><flake8>
2025-09-25 00:50:32
1
633
David Wasserman
79,774,255
6,307,865
pyspark on Windows - unexpected termination during collect()
<p>I am new to python and pyspark.</p> <p>I'm trying to run it on Windows Server 2022. I have environment variables</p> <ul> <li><code>HADOOP_HOME=C:\spark\hadoop</code></li> <li><code>JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.16.8-hotspot</code></li> <li><code>SPARK_HOME=C:\spark\spark-4.0.1-bin-hadoop3</code></l...
<python><apache-spark><pyspark><windows-server>
2025-09-24 23:28:00
1
621
EdH
79,774,117
12,415,855
Getting element using re.compile with bs4?
<p>i try to find a span element using selenium and bs4 with the following code:</p> <pre><code>import re from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service import time options = Options() options.add_a...
<python><selenium-webdriver><beautifulsoup>
2025-09-24 19:56:28
2
1,515
Rapid1898