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,596,118 | 6,893,983 | Safely extract uploaded ZIP files in Python | <p>I'm working on a python REST API that allows users to upload ZIP files. Before extracting them, I want to protect against common vulnerabilities, especially Zip bombs. Is there a way (ideally based on standard libraries like zipfile) to safely validate and extract ZIP uploads in Python?</p>
<p>I looked into third-pa... | <python><zip><python-zipfile> | 2025-04-28 09:10:00 | 3 | 994 | sevic |
79,595,959 | 4,041,117 | Matplotlib figure with 2 animation subplots: how to update both | <p>I'm trying to vizualize simulation results with a figure containing 2 subplots using matplotlib pyplot. Both should contain animation: one uses netgraph library (it's a graph with nodes showing flows of the network) and the other should plot a line graph of another 2 variables (to keep it simple here lets use: sin(x... | <python><matplotlib><animation><subplot><netgraph> | 2025-04-28 07:12:53 | 1 | 481 | carpediem |
79,595,864 | 436,287 | Python time.strftime gives different results for %Z and %z | <p>I'm getting some strange behavior when I pass a UTC time struct to python's <a href="https://docs.python.org/3/library/time.html#time.strftime" rel="nofollow noreferrer"><code>time.strftime</code></a>. Using <code>%z</code> seems to always give me my local offset rather than 0:</p>
<pre class="lang-py prettyprint-ov... | <python><macos><time><strftime> | 2025-04-28 05:53:15 | 3 | 8,517 | onlynone |
79,595,840 | 15,416,614 | Why doesn't multiprocessing.Process.start() in Python guarantee that the process has started? | <p>Here is a code to demo my question:</p>
<pre><code>from multiprocessing import Process
def worker():
print("Worker running")
if __name__ == "__main__":
p = Process(target=worker)
p.start()
input("1...")
input("2...")
p.join()
</code></pre>
<p>Note, ... | <python><python-3.x><multiprocessing><python-multiprocessing> | 2025-04-28 05:16:02 | 1 | 387 | Gordon Hui |
79,595,836 | 4,352,047 | Generating key - value map from aggregates | <p>I have raw data that appears like this:</p>
<pre><code>┌─────────┬────────┬─────────────────────┐
│ price │ size │ timestamp │
│ float │ uint16 │ timestamp │
├─────────┼────────┼─────────────────────┤
│ 1697.0 │ 11 │ 2009-09-27 18:00:00 │
│ 1697.0 │ 5 │ 2009-09-27 18:00:00 │
│ 1... | <python><sql><duckdb> | 2025-04-28 05:09:08 | 1 | 379 | Deftness |
79,595,835 | 6,455,731 | Connection pooling with httpx.Client | <p>The <a href="https://www.python-httpx.org/advanced/clients/" rel="nofollow noreferrer">clients</a> section in the <code>httpx</code> docs mention connection pooling and generally recommend the use of <code>httpx.Client</code>.</p>
<p>I cannot read from the docs or from anywhere else however, if connection pooling is... | <python><connection-pooling><httpx> | 2025-04-28 05:08:17 | 1 | 964 | lupl |
79,595,804 | 10,704,286 | Custom Shaping in pandas for Excel Output | <p>I have a dataset with world population (For clarity, countries are limmited to Brazil, Canada, Denmark):</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
world = pd.read_csv("../data/worldstats.csv")
cond = world["country"].isin(["Brazil","Canada",&quo... | <python><pandas> | 2025-04-28 04:31:29 | 1 | 1,081 | Demeter P. Chen |
79,595,772 | 17,729,094 | Modify list of arrays in place | <p>I have a df like:</p>
<pre class="lang-py prettyprint-override"><code># /// script
# requires-python = ">=3.13"
# dependencies = [
# "polars",
# ]
# ///
import polars as pl
df = pl.DataFrame(
{
"points": [
[
[1.0, 2.0],
],
... | <python><dataframe><python-polars><polars> | 2025-04-28 03:55:20 | 1 | 954 | DJDuque |
79,595,753 | 5,118,421 | sql alchemy generates integer instead of int for sql lite | <p>Python Sql Alchemy generates table with VARCHAR for sql lite instead of INTEGER so select for sql lite ordered by with alphabet number</p>
<p>Given City Table in Sql lite generated from sql alchemy:</p>
<pre><code>class City(Base):
__tablename__ = "city"
id: Mapped[int] = mapped_column(Integer, primary_key... | <python><sqlite><sqlalchemy> | 2025-04-28 03:25:52 | 2 | 1,407 | Irina |
79,595,678 | 785,494 | How can I store ids in Python without paying the 28-byte-per-int price? | <p>My Python code stores millions of ids in various data structures, in order to implement a classic algorithm. The run time is good, but the memory usage is awful.</p>
<p>These ids are <code>int</code>s. I assume that since Python ints start at 28 bytes and grow, there's a huge price there. Since they're just opaque ... | <python><memory><data-structures><space-complexity><python-internals> | 2025-04-28 01:35:56 | 1 | 9,357 | SRobertJames |
79,595,515 | 1,394,353 | urlparse/urlsplit and urlunparse, what's the Pythonic way to do this? | <p>The background (but is not a Django-only question) is that the Django test server does not return a scheme or netloc in its response and request urls.</p>
<p>I get <code>/foo/bar</code> for example, and I want to end up with <code>http://localhost:8000/foo/bar</code>.</p>
<p><code>urllib.parse.urlparse</code> (but... | <python><url> | 2025-04-27 21:26:15 | 1 | 12,224 | JL Peyret |
79,595,462 | 2,009,594 | How to pass a byte buffer from python to C++ | <p>I am creating a library in C++ with Python bindings.</p>
<p>The library takes buffer created in Python code and processes it in several ways. On my way to achieve that, I used the example below generated by Google's Gemini as starter for that part of the code. But I am getting an error:</p>
<p>Here is the C++ code:<... | <python><c++><pybind11> | 2025-04-27 20:21:58 | 1 | 6,929 | feeling_lonely |
79,595,383 | 5,123,111 | How to further decrease financial data size? | <p>I’ve been working on compressing tick data and have made some progress, but I’m looking for ways to further optimize file sizes. Currently, I use delta encoding followed by saving the data in Parquet format with ZSTD compression, and I’ve achieved a reduction from 150MB to 66MB over 4 months of data, but it still fe... | <python><compression><zstd> | 2025-04-27 18:55:23 | 0 | 1,369 | lazarea |
79,595,283 | 14,492,001 | How to properly extract all duplicated rows with a condition in a Polars DataFrame? | <p>Given a polars dataframe, I want to extract all duplicated rows while also applying an additional filter condition, for example:</p>
<pre><code>import polars as pl
df = pl.DataFrame({
"name": ["Alice", "Bob", "Alice", "David", "Eve", "Bob", &... | <python><dataframe><python-polars> | 2025-04-27 17:21:44 | 1 | 1,444 | Omar AlSuwaidi |
79,595,277 | 774,133 | Stratification fails in train_test_split | <p>Please consider the following code:</p>
<pre class="lang-py prettyprint-override"><code>
import pandas as pd
from sklearn.model_selection import train_test_split
# step 1
ids = list(range(1000))
label = 500 * [1.0] + 500 * [0.0]
df = pd.DataFrame({"id": ids, "label": label})
# step 2
train_p =... | <python><scikit-learn> | 2025-04-27 17:17:11 | 1 | 3,234 | Antonio Sesto |
79,595,257 | 843,458 | tkinter layout problem, pack does not place the elements as expected | <p>I want to have three elements.
The first two aligned left and the third below spanning the remaining space in x and y.</p>
<p>This code however does not realized that
import ttkbootstrap as tb</p>
<pre><code>class App(tb.Window):
def __init__(self):
# Initialize window with superhero theme
super(... | <python><tkinter><layout> | 2025-04-27 16:44:48 | 1 | 3,516 | Matthias Pospiech |
79,595,225 | 9,646,203 | How python MRO works in hierarchical and multiple inheritance | <p>So far it's making me confuse, how below code to understand for the given result. Can someone explain below two parts of output how actually flow is going on. First part giving output as 'C' and second part is 'A'</p>
<pre><code>class A:
def fun1(self):
print("A")
class B(A):
def fun1(sel... | <python> | 2025-04-27 16:12:39 | 1 | 615 | Saisiva A |
79,595,214 | 2,522,892 | LinkedIn API: Authorization Error When Posting on Behalf of Organization | <p>I’m developing an application that integrates with the LinkedIn API to post content on behalf of our organization. Despite being listed as a super admin and having the following OAuth 2.0 scopes:</p>
<p><a href="https://i.sstatic.net/O9ynpKg1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/O9ynpKg1.pn... | <python><linkedin-api> | 2025-04-27 15:52:28 | 0 | 575 | Lucky |
79,595,168 | 14,947,895 | Numpy IO seems to have an 2GB overhead in StorNex (cvfs) File System | <p><strong>TL;DR:</strong></p>
<ul>
<li>Initally I thought the numpy load functions doubles memory usage at peak</li>
<li>after some additional tests it seems like the underlying file system (StorNex [cfvs]) leads to a size-independent 2GB overhead</li>
<li>jump to EDIT 4 for the current status.</li>
</ul>
<hr />
<hr /... | <python><numpy><io><numpy-ndarray><memprof> | 2025-04-27 15:10:26 | 0 | 496 | Helmut |
79,595,116 | 7,916,257 | log-log time series plot with event markers | <p>I want to create a log-log plot showing the growth of publications over time (papers/year), similar to scientific figures like Fig. 1a in "A Century of Physics" (Nature Physics 2015).</p>
<p><strong>Requirements:</strong></p>
<ol>
<li>Y-axis (number of papers) on a log scale (10²–10⁶) with ticks at each po... | <python><matplotlib><plot> | 2025-04-27 14:13:09 | 1 | 919 | Joe |
79,594,983 | 1,593,077 | Why does np.fromfile fail when reading from a pipe? | <p>In a Python script, I've written:</p>
<pre><code># etc. etc.
input_file = args.input_file_path or sys.stdin
arr = numpy.fromfile(input_file, dtype=numpy.dtype('f32'))
</code></pre>
<p>when I run the script, I get:</p>
<pre><code>$ cat nums.fp32.bin | ./myscript
File "./myscript", line 123, in main
ar... | <python><numpy><file-io><pipe> | 2025-04-27 11:42:32 | 1 | 137,004 | einpoklum |
79,594,796 | 12,645,782 | Edit Google Drive and Sheets Files (Airflow Google Provider): Insufficient credentials | <p>I am trying to modify a Google Sheets file and a CSV file in Google Drive via the Apache Airflow Google Provider:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(data)
csv_data = df.to_csv(index=True)
gcs_hook = GCSHook(gcp_conn_id=GOOGLE_CONNECTION)
gcs_hook.upload(
bucket_name=GOOGLE_CL... | <python><google-cloud-platform><google-drive-api><airflow><google-sheets-api> | 2025-04-27 07:27:04 | 1 | 620 | Kotaka Danski |
79,594,793 | 6,141,238 | How do I change a global constant of a loaded module so that other global variables of the loaded module that depend on it reflect the change? | <p>This question may have a simple answer. I have a near-trivial module0.py:</p>
<pre><code>a = 1
b = a + 3
</code></pre>
<p>I import this module into a script and redefine module0's global constant <code>a</code>:</p>
<pre><code>import module0 as m0
m0.a = 2
print(m0.b)
</code></pre>
<p>However, when I run this code,... | <python><import><namespaces><global-variables><python-import> | 2025-04-27 07:23:08 | 0 | 427 | SapereAude |
79,594,723 | 843,458 | pyhton TTKBootstrap Menu - style not applied | <p>I tried TTKBootstrap instead of tkinter and it looks great. However the menu has not been adapted.</p>
<p>I do the following: Create a Windows based on <code>tb.Window</code></p>
<pre><code>import ttkbootstrap as tb
class App(tb.Window):
def __init__(self):
super().__init__()
# configure the ro... | <python><tkinter><ttkbootstrap> | 2025-04-27 06:04:01 | 1 | 3,516 | Matthias Pospiech |
79,594,401 | 14,551,796 | Why am I getting errors with discord.ActionRow in discord.py? | <p>I'm trying to create a game using buttons in Discord with <code>discord.py</code>, and I'm using <code>discord.ActionRow</code>, but it's giving me errors. Here's the function for context:</p>
<pre class="lang-py prettyprint-override"><code>async def create_game_board(self, view, callback):
buttons = []
... | <python><discord.py> | 2025-04-26 21:02:23 | 1 | 455 | benz |
79,594,266 | 9,651,461 | How do I get the size in bytes of a WriteableBuffer? | <p>Previous question: <a href="https://stackoverflow.com/questions/79594143/how-do-i-add-a-type-hint-for-a-writeablebuffer-parameter/79594171#79594171">How do I add a type hint for a WriteableBuffer parameter?</a></p>
<p>I'm trying to implement the <code>readinto()</code> method of a <code>RawIOBase</code> subclass wit... | <python><python-typing><pyright> | 2025-04-26 18:16:37 | 2 | 1,194 | Maks Verver |
79,594,143 | 9,651,461 | How do I add a type hint for a WriteableBuffer parameter? | <p>I'm trying to add a parameter type to the <code>readinto()</code> method declared in a custom class that derives from <code>RawIOBase</code>, like this:</p>
<pre class="lang-py prettyprint-override"><code>from io import RawIOBase
class Reader(RawIOBase):
def readinto(self, buf: bytearray) -> int:
pas... | <python><python-typing><pyright> | 2025-04-26 16:17:20 | 1 | 1,194 | Maks Verver |
79,594,108 | 1,908,650 | How can I stop a matplotlib table overlapping a graph? | <p>The MWE below produces a plot like this:</p>
<p><a href="https://i.sstatic.net/lGiuB189.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lGiuB189.png" alt="enter image description here" /></a></p>
<p>The row labels, <code>X</code>, <code>Y</code>, <code>Z</code>, overlap the right hand side of the bar ... | <python><matplotlib> | 2025-04-26 15:42:54 | 3 | 9,221 | Mohan |
79,593,965 | 16,813,096 | How to get list of all the available capture devices in python without using any external module? (Windows) | <p>I want to retrieve a list of available webcams on Windows, without relying on external libraries such as OpenCV, PyGrabber, or Pygame.</p>
<p>Although I found a code snippet that accomplishes this task, but it uses WMIC. Unfortunately, when I tested it on another Windows device, I encountered an error stating <code>... | <python><python-3.x><webcam-capture> | 2025-04-26 13:25:17 | 2 | 582 | Akascape |
79,593,938 | 10,966,844 | While testing airflow task with pytest, I got an error | <p>While testing airflow with pytest, i got an Error.</p>
<pre><code># tests/conftest.py
import datetime
import pytest
from airflow.models import DAG
@pytest.fixture
def test_dag():
return DAG(
"test_dag",
default_args={
"owner": "airflow",
&qu... | <python><airflow><pytest> | 2025-04-26 13:00:04 | 1 | 343 | hhk |
79,593,911 | 3,555,115 | Pair all elements leaving alternate element in a list and form a new list of lists | <p>I have a list which I would like to have unique element pairs generated for every alternate element</p>
<pre><code>List = [ L1, L2, L3, L4, L5, L6, L7,L8 ]
List_in_pairs = [[L1,L3], [L2,L4], [L5,L7],[L6,L8]]
</code></pre>
<p>I tried</p>
<pre><code>list_in_pairs = list(zip(List[::1], List[2::1]))
</code></pre>
<p>bu... | <python> | 2025-04-26 12:27:53 | 3 | 750 | user3555115 |
79,593,886 | 774,575 | How to use Model-View with a QCheckBox? | <p>How to use the model-view approach with a checkbox? The view is expected to display the model status but when the user clicks on the view, the checkbox status is actually changed before it is told by the model. For example the sequence should be:</p>
<ul>
<li>Current model state is <code>unchecked</code> and CB stat... | <python><model><qt5><pyside2><qcheckbox> | 2025-04-26 11:46:56 | 1 | 7,768 | mins |
79,593,818 | 577,288 | concurrent.futures not showing thread completion | <pre><code>import concurrent.futures
import random
import pdb
# Analysis of text packet
def Threads1(curr_section, index1):
words = open('test.txt', 'r', encoding='utf-8', errors='ignore').read().replace('"', '').split()
longest_recorded = []
for ii1 in words:
test1 = random.randint(1, 1000)
... | <python><multithreading><concurrent.futures> | 2025-04-26 10:22:48 | 2 | 5,408 | Rhys |
79,593,659 | 13,538,030 | Check whether one string can be formed by another string in Python | <p>I want to check whether one string can be formed by another string, e.g., in the example below, I want to check how many strings in the list <code>targets</code> can be formed by string <code>chars</code>. Each character in <code>chars</code> can only be used once.</p>
<pre><code>targets = ["cat","bt&... | <python><string> | 2025-04-26 06:59:59 | 2 | 384 | Sophia |
79,593,506 | 1,614,051 | How can I annotate a function that takes a tuple of types and returns an object of one of those types? | <p>I want to annotate a function that essentially does this:</p>
<pre><code>def safe_convert(value: Any, allowed_types: tuple):
if isinstance(value, allowed_types):
return value
raise TypeError()
</code></pre>
<p>Now, my intention is for <code>allowed_types</code> to be a tuple of type objects, and to t... | <python><python-typing> | 2025-04-26 01:47:36 | 1 | 2,072 | Filipp |
79,593,505 | 12,921,500 | Can't close cookie pop up on website with selenium webdriver | <p>I am trying to use selenium to click the Accept all or Reject all button on a cookie pop up for the the website <a href="https://autotrader.co.uk" rel="nofollow noreferrer">autotrader.co.uk</a>, but I cannot get it to make the pop up disappear for some reason.</p>
<p>This is the pop up:</p>
<p><a href="https://i.sst... | <python><selenium-webdriver><web-scraping><selenium-chromedriver> | 2025-04-26 01:47:28 | 2 | 785 | teeeeee |
79,593,499 | 7,076,615 | astor, ast, astunparse do not preserve lineno, astmonkey puts \ (backslash) everywhere | <p>Here is the output run on a very simple urls.py from a test Django project:</p>
<pre><code>from django.contrib import admin
from django.urls import path
urlpatterns = [\
path('test_path1/', views.test_view1, name='test_name1'), \
path('test_path2/', views.test_view1, name='test_name1'), path('admin/', admin... | <python><parsing><abstract-syntax-tree><code-injection><line-numbers> | 2025-04-26 01:37:00 | 0 | 643 | Daniel Donnelly |
79,593,281 | 813,951 | How to prevent unescaped program arguments | <p>This test program parses a single text argument, which could be a URL:</p>
<pre><code>#!/usr/bin/env python
import argparse
def parse_input():
parser = argparse.ArgumentParser(
description='Program description'
)
parser.add_argument('input_text', type=str, help='A string')
args = parser.par... | <python><bash><escaping><code-injection><shebang> | 2025-04-25 20:39:55 | 1 | 28,229 | Mister Smith |
79,593,227 | 226,499 | How to detect MIME type from a file buffer in Python, especially for legacy Office formats like .xls, .doc, .ppt? | <p>I'm building a general-purpose Python library for text extraction that should support input from either:</p>
<ul>
<li>A file path (e.g., str pointing to a local file),</li>
</ul>
<p>or</p>
<ul>
<li>A file-like object (e.g., BytesIO stream, such as you'd get from a
web upload or in-memory operation)</li>
</ul>
<p>To ... | <python><mime-types><file-type><python-magic><libmagic> | 2025-04-25 19:52:41 | 1 | 606 | GBBL |
79,592,979 | 12,550,791 | Assert a logger writes to stdout | <p>I'm trying to assert the fact that my loggers writes to stdout, but I can't get it to work. I ran the logger in a python file to make sure it outputs something in the standard output.</p>
<p>So far, I can assert with pytest that the message is logged:</p>
<pre class="lang-py prettyprint-override"><code>import loggin... | <python><logging><pytest><python-logging> | 2025-04-25 16:47:59 | 0 | 391 | Marco Bresson |
79,592,693 | 13,061,449 | Why does pd.to_datetime('2025175', format='%Y%W%w') and pd.Timestamp.fromisocalendar(2025, 17, 5) gives different output? | <p>Why does <code>pd.to_datetime('2025175', format='%Y%W%w')</code> and <code>pd.Timestamp.fromisocalendar(2025, 17, 5)</code> gives different output?</p>
<p>I expected to obtain <code>Timestamp('2025-04-25 00:00:00')</code> for both cases.
But the first approach resulted on a Friday one week ahead.</p>
<p>Minimum exam... | <python><pandas><datetime><timestamp> | 2025-04-25 14:10:53 | 1 | 315 | viniciusrf1992 |
79,592,652 | 16,383,578 | Why using a bigger wheel doesn't make my wheel factorization prime sieve faster? | <p>I assume you all know what prime numbers are and what Sieve of Eratosthenes is, so I won't waste time explaining them.</p>
<p>Now, all prime numbers except 2 are odd numbers, so we only need to check odd numbers, this is very obvious, but this is worth mentioning because this simple optimization halved the candidate... | <python><sieve-of-eratosthenes><wheel-factorization> | 2025-04-25 13:46:58 | 1 | 3,930 | Ξένη Γήινος |
79,592,549 | 7,394,414 | Cannot interpret 'dtype('int64')' in NLP Python Code from adashofdata | <p>I am trying to run the NLP project shared at <a href="https://github.com/adashofdata/nlp-in-python-tutorial" rel="nofollow noreferrer">https://github.com/adashofdata/nlp-in-python-tutorial</a>, but I am encountering an issue with the code in 4-Topic-Modeling.ipynb. I am running the code on Google Colab and experienc... | <python><nlp><google-colaboratory> | 2025-04-25 12:48:00 | 1 | 579 | mymiracl |
79,592,530 | 1,635,523 | tkinter.Listbox has a "shadow selection" beside the proper selection. How to sync both? | <p>I built and populated a <code>tkinter.Listbox</code>. Now I have events that will select
the item at index <code>index</code>. Like so:</p>
<pre class="lang-py prettyprint-override"><code>listbox.selection_clear(0, tk.END)
listbox.select_set(index)
</code></pre>
<p>And it works in that the entry with index <code>ind... | <python><python-3.x><tkinter> | 2025-04-25 12:34:41 | 2 | 1,061 | Markus-Hermann |
79,592,525 | 3,840,551 | Static typing for database schema models that handle foreign keys/dbrefs as `external_document: ExternalDocumentModel | DbRef` | <p>We're using Python (3.12) with Pydantic models to represent schemas for our MongoDB collections, which we then instantiate with <code>SomeModel.model_validate(<results of pymongo query>)</code>. We define relationships between collections using dbrefs; but we don't have an elegant way to handle these in a type... | <python><pymongo><python-typing><pydantic> | 2025-04-25 12:31:22 | 0 | 1,529 | Gloomy |
79,592,071 | 11,829,002 | Doxygen docstring displayable in vscode | <p>I have a Python code, and I recently discovered Doxygen which generates the documentation automatically from the source code.
If I understood correctly, to make the generated code well detected by Doxygen, the doc string should be like this :</p>
<pre class="lang-py prettyprint-override"><code>def f(self, x, y):
... | <python><visual-studio-code><doxygen><docstring> | 2025-04-25 07:59:28 | 1 | 398 | Thomas |
79,592,065 | 12,415,855 | 403-response when doing a python request? | <p>i try to do a get request using the follwing code -</p>
<p>(i have taken the get response from this site:
<a href="https://www.marinetraffic.com/en/ais/home/centerx:-15.7/centery:25.1/zoom:3" rel="nofollow noreferrer">https://www.marinetraffic.com/en/ais/home/centerx:-15.7/centery:25.1/zoom:3</a>
copied it with righ... | <python><curl><request> | 2025-04-25 07:55:39 | 1 | 1,515 | Rapid1898 |
79,591,974 | 15,157,684 | Error Running OCR with Qwen2.5-VL in Colab | <p>I am trying to run the OCR functionality of Qwen2.5-VL by following the tutorial provided in this notebook: <a href="https://github.com/QwenLM/Qwen2.5-VL/blob/main/cookbooks/ocr.ipynb?spm=a2ty_o01.29997173.0.0.4f11c921W6BADP&file=ocr.ipynb" rel="nofollow noreferrer">OCR Tutorial Notebook</a></p>
<p>However, I am... | <python><gpu><ocr><large-language-model> | 2025-04-25 07:05:18 | 0 | 1,951 | JS3 |
79,591,938 | 11,770,390 | Why does pip install fail due to project layout when installing dependencies? | <p>Upon running <code>python -m pip install .</code> I get the following error:</p>
<pre class="lang-none prettyprint-override"><code>$ python -m pip install .
Processing /home/user/dev/report-sender/report_broadcaster
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: sub... | <python><pip><dependencies><pyproject.toml> | 2025-04-25 06:45:35 | 1 | 5,344 | glades |
79,591,859 | 1,909,927 | Nixos - Flask - ModuleNotFoundError | <p>I wanted to add a form to my flask-based website, but I got the following error message:</p>
<pre><code>Apr 24 21:18:04 nixos uwsgi[2261]: from flask_wtf import FlaskForm
Apr 24 21:18:04 nixos uwsgi[2261]: ModuleNotFoundError: No module named 'flask_wtf'
</code></pre>
<p>Here are the installed packages part of m... | <python><flask><pip><nixos> | 2025-04-25 05:30:58 | 1 | 783 | picibucor |
79,591,819 | 2,552,290 | Why does a==b call b.__eq__ when derived from list and tuple with missing override? | <h2>Background</h2>
<p>I am writing math utility classes <code>ListVector</code> and <code>TupleVector</code>,
inheriting from <code>list</code> and <code>tuple</code> respectively:</p>
<pre><code>class ListVector(list):
...
class TupleVector(tuple):
...
</code></pre>
<p>(Aside: I'm not necessarily claiming this i... | <python><inheritance> | 2025-04-25 04:45:49 | 2 | 5,611 | Don Hatch |
79,591,781 | 563,299 | Python: partial TypedDict for a wrapper function (mypy) | <p>Consider the file below named <code>test.py</code>, which gives an error in mypy (though it does work correctly). Although greatly simplified here, I want to create a wrapper function that changes the default value of the function that it wraps, but otherwise passes along all kwargs to that wrapped function. I wan... | <python><python-typing><mypy><typeddict> | 2025-04-25 03:54:37 | 0 | 2,612 | Scott B |
79,591,713 | 24,271,353 | Splitting the time dimension of nc data using xarray | <p>Now I have a time<em>lon</em>lat 3D data where time is recorded as year, month and day. I need to split time in the form of year*month+day. So that the data becomes 4 dimensional. How should I do this?</p>
<p>I have given a simple data below:</p>
<pre class="lang-py prettyprint-override"><code>import xarray as xr
im... | <python><pandas><python-xarray> | 2025-04-25 02:30:01 | 2 | 586 | Breeze |
79,591,637 | 166,601 | How do I make a script accessible across all directories within a python monorepo using uv? | <p>I have a python monorepo with a top-level <code>pyproject.toml</code>. The monorepo contains a projects directory each with its own python package and <code>pyproject.toml</code> file. Some of these projects define scripts:</p>
<pre><code>[project.script]
aaa = "aaa.something:main"
</code></pre>
<p>Within ... | <python><uv> | 2025-04-25 00:43:17 | 2 | 3,953 | jbcoe |
79,591,629 | 11,609,834 | Torch tensor dataloader shape issue | <p>I have a simple application of <code>torch.DataLoader</code> that gets a nice performance boost. It's created by the <code>tensor_loader</code> in the following example.</p>
<pre><code>from torch.utils.data import DataLoader, TensorDataset, BatchSampler, RandomSampler
import numpy as np
import pandas as pd
def tens... | <python><pytorch><pytorch-dataloader> | 2025-04-25 00:31:13 | 1 | 1,013 | philosofool |
79,591,487 | 2,526,586 | Roll back a commit? | <p><em>Note: This question focuses on web apps utilising MySQL's transactions - commit and rollback. Even though the code samples below use Python, the problem itself is not limited to the choice of programming language building the web app.</em></p>
<p>Imagine I have two files: <code>main.py</code> and <code>my_dao.py... | <python><mysql><transactions><rollback> | 2025-04-24 21:33:57 | 1 | 1,342 | user2526586 |
79,591,467 | 13,634,560 | plotly python: go.chloroplethmap location auto zoom | <p>I cannot seem to find a similar question here on SO, but please direct me there if such a question already exists.</p>
<p>I have a function that plots values on a map, as below. The graph works fine. Note that it is the <strong><code>go.Chloroplethmap()</code></strong> function, as opposed to the <code>go.Chloroplet... | <python><plotly> | 2025-04-24 21:12:33 | 1 | 341 | plotmaster473 |
79,591,459 | 301,081 | pip building wheel for wxPython on Ubuntu | <p>I have tried to install wxPython on Python versions 3.10, 3.12, and 3.13, and they all fail with much the same error.
I've installed as many of the required packages as are necessary.
Does anyone have any ideas as to what the problem is?</p>
<pre><code>2025-04-24T15:50:35,367 make[1]: *** [Makefile:28693: coredll_... | <python><python-3.x><pip><wxpython> | 2025-04-24 21:03:45 | 0 | 435 | cnobile |
79,591,253 | 2,410,605 | I can run an RPA exe by going to the server directory and double clicking it, but get an error using a command line | <p>I've built an RPA that runs fine as a .py. I turned it into an .exe and it ran fine that way as well. Next I moved it to the production server that it will run from and using File Explorer, double clicked on the exe and again it ran fine.</p>
<p>The job is scheduled to run from a SQL Server Job Scheduler, and when i... | <python><command-line><sql-server-job> | 2025-04-24 18:21:10 | 0 | 657 | JimmyG |
79,591,152 | 9,465,029 | Root mean square linearisation for linear programming | <p>I am trying to linearise the function root mean square to use it in a linear optimisation or Mixed integer linear optimisation. Any idea how I could do this? For instance with the example below, if I wanted to maximize P*100, the model would give P=10, Q = 0 and S=10.</p>
<p>Many thanks</p>
<pre><code>import numpy a... | <python><optimization><pulp> | 2025-04-24 17:08:24 | 1 | 631 | Peslier53 |
79,590,866 | 16,611,809 | How to make a reactive event silent for a specific function? | <p>I have the app at the bottom. Now, I have this preset field where I can select from 3 options (+ the option <code>changed</code>). What I want to be able to set the input_option with the preset field. But I also want to be able to change it manually. If I change the input_option manually the preset field should swit... | <python><py-shiny> | 2025-04-24 14:31:24 | 1 | 627 | gernophil |
79,590,719 | 3,854,191 | How to display inactive inherit_children_ids lines in ir.ui.view's form? | <p>In the model <code>ir.ui.view</code> in odoo 18, i want to get the inactive lines of the one2Many-field: <code>inherit_children_ids</code> as permanently displayed.</p>
<p>I have tried to customize using a custom module (see below) but it does not change anything: the inactive line of <code>inherit_children_ids</cod... | <python><xml><view><one2many><odoo-18> | 2025-04-24 13:28:05 | 1 | 1,677 | S Bonnet |
79,590,570 | 2,123,706 | save table in python as image | <p>I want to save a dataframe as a table in python.</p>
<p>Following <a href="https://plotly.com/python/table/" rel="nofollow noreferrer">https://plotly.com/python/table/</a>, I can save a table as an image, but only the first few rows, not the entire dataset.</p>
<p><a href="https://i.sstatic.net/E4Kc3H9Z.png" rel="no... | <python><plotly><save-image> | 2025-04-24 12:18:36 | 1 | 3,810 | frank |
79,590,554 | 538,256 | python pipes deprecated - interact with mpg123 server | <p>I wrote some years ago an iTunes-replacing program in Python, with mpg123 accessed by a pipe (from the manual: <code>-R, --remote: Activate generic control interface. mpg123 will then read and execute commands from stdin. Basic usage is ``load <filename>'' to play some file</code>).</p>
<p>I dont have avail... | <python><pipe><mpg123> | 2025-04-24 12:10:36 | 1 | 4,004 | alessandro |
79,590,536 | 1,593,077 | What Python exception should I raise when an input file has the wrong size? | <p>I'm writing a Python script which reads some input from a file. The input size can be calculated using other information the script has, and the file must have exactly that. Now, if I check and figure out that the file size is not as expected - what kind of exception should I raise?</p>
<p>I had a look at the <a hre... | <python><exception><error-handling><file-io> | 2025-04-24 12:02:26 | 1 | 137,004 | einpoklum |
79,590,189 | 5,786,649 | Closing a session in Flask, SQLAlchemy to delete the temporary file | <p>I know there are similar questions out there, but none answered my problem.</p>
<p>I am using a basic test setup in Flask using SQLAlchemy, that is a slightly modified version of the Flask-tutorial tests. My problem is that the temporary file created by the app-fixture cannot be closed. This is the fixture:</p>
<pre... | <python><flask><sqlalchemy> | 2025-04-24 08:57:24 | 2 | 543 | Lukas |
79,590,090 | 8,291,840 | model.predict hangs in celery/uwsgi | <pre class="lang-py prettyprint-override"><code>import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from apps.common.utils.error_handling import suppress_callable_to_sentry
from django.conf import settings
from threading import Lock
MODEL_PATH = settings.BASE_DIR / "apps/core/utils/nsfw_detect... | <python><django><tensorflow><keras><celery> | 2025-04-24 08:10:45 | 0 | 3,042 | Işık Kaplan |
79,589,899 | 8,913,338 | How to resume halted core to work with pylink | <p>I am using the <code>pylink</code> library for accessing JLINK.</p>
<p>How can I from <code>pylink</code> run the processor when it halted (similar to the vscode debugger continue command).</p>
<p>I know that there is <a href="https://pylink.readthedocs.io/en/latest/pylink.html#pylink.jlink.JLink.reset" rel="nofollo... | <python><arm><segger-jlink> | 2025-04-24 05:52:29 | 1 | 511 | arye |
79,589,800 | 10,445,333 | Find corresponding date of max value in a rolling window of each partition | <p>Sample code:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
from datetime import date
from random import randint
df = pl.DataFrame({
"category": [cat for cat in ["A", "B"] for _ in range(1, 32)],
"date": [date(2025, 1, i) for _ in ["A&qu... | <python><sql><dataframe><window-functions><python-polars> | 2025-04-24 03:59:03 | 1 | 2,333 | Jonathan |
79,589,689 | 11,462,274 | RSS Memory and Virtual Memory do not decrease even after killing a playwright instance and creating a completely new one | <p>I'm doing continuous iteration tests with playwright on a website and I noticed that RSS Memory and Virtual Memory are gradually increasing and no direct method is managing to dissipate the memory consumption. I've already tried every 100 iterations:</p>
<ol>
<li>Refresh the current page to avoid generating memory w... | <python><playwright><playwright-python><psutil> | 2025-04-24 01:27:39 | 0 | 2,222 | Digital Farmer |
79,589,564 | 1,413,856 | Is it possible to limit attributes in a Python sub class using __slots__? | <p>One use of <code>__slots__</code> in Python is to disallow new attributes:</p>
<pre class="lang-py prettyprint-override"><code>class Thing:
__slots__ = 'a', 'b'
thing = Thing()
thing.c = 'hello' # error
</code></pre>
<p>However, this doesn’t work if a class inherits from another slotless class:</p>
<pre cla... | <python><inheritance><subclass> | 2025-04-23 22:12:02 | 1 | 16,921 | Manngo |
79,589,524 | 4,045,275 | Apply different aggregate functions to different columns of a pandas dataframe, and run a pivot/crosstab? | <h2>The issue</h2>
<p>In SQL it is very easy to apply different aggregate functions to different columns, e.g. :</p>
<pre><code>select item, sum(a) as [sum of a], avg(b) as [avg of b], min(c) as [min of c]
</code></pre>
<p>In Python, not so much. For a simple groupby, this <a href="https://stackoverflow.com/questions/6... | <python><pandas><dataframe><group-by> | 2025-04-23 21:31:33 | 1 | 9,100 | Pythonista anonymous |
79,589,289 | 4,841,248 | Is it good practice to override an abstract method with more specialized signature? | <p><em>Background information below the question.</em></p>
<p>In Python 3, I can define a class with an abstract method and implement it in a derived class using a more specialized signature. I know this works, but like many things work in many programming languages, it may not be good practice. So is it?</p>
<pre clas... | <python><python-3.x><inheritance><overriding> | 2025-04-23 18:37:27 | 2 | 2,473 | Maarten Bamelis |
79,589,222 | 150,510 | How do I make torch.ones(...) work inside a traced wrapper model during symbolic_trace()? | <p>Thanks for giving this a read...</p>
<p>I am getting going with PyTorch. I’m building a tool that wraps HuggingFace models in a custom WrappedModel so I can trace their execution using torch.fx.symbolic_trace. The goal is to analyze the traced graph and detect certain ops like float32 usage.</p>
<p>To do this, I:</p... | <python><pytorch><huggingface-transformers><torch> | 2025-04-23 17:57:16 | 1 | 5,358 | Peter |
79,589,185 | 1,450,294 | Python interpreter doesn't honour .inputrc readline settings when run from a venv | <p>My <code>.inputrc</code> file, which simply contains <code>set editing-mode vi</code>, means that when I use Bash and some other interpretive environments, I can use Vi editor keys. This also works when I run the system Python interpreter. But when I run the Python interpreter in a venv (Python virtual environment),... | <python><linux><readline><key-bindings><venv> | 2025-04-23 17:38:54 | 1 | 7,291 | Michael Scheper |
79,589,116 | 1,631,159 | Request to create a note in Google Keep returns invalid argument | <p>I'm trying to create notes in Google Keep using API, here is the python script:</p>
<pre><code>import sys
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
# Define the required scopes for Google Sheets and Keep
SCOPES = [
... | <python><google-keep-api> | 2025-04-23 16:57:25 | 1 | 769 | Rami Sedhom |
79,589,019 | 395,857 | How to avoid auto-scroll when add a lot of text in a `TextArea` in Gradio? | <p>In one adds a lot of text in a <code>TextArea</code> in Gradio, it auto-scrolls to the end of the text. Example:</p>
<pre><code>import gradio as gr
def show_text():
return '\n'.join([f'test{i}' for i in range(50)]) # Simulated long text
with gr.Blocks() as demo:
text_area = gr.TextArea(label="Output&... | <python><gradio> | 2025-04-23 15:55:38 | 1 | 84,585 | Franck Dernoncourt |
79,589,015 | 4,662,490 | How to use a xmlrpc.client.ServerProxy object in package function? | <p>I am working with the Odoo XML-RPC API and <strong>I want to reuse a connection</strong> (ServerProxy object) across multiple functions in my package.</p>
<p><strong>Current Setup</strong></p>
<p>I establish the connection like this:</p>
<pre><code>import xmlrpc.client
import pprint
# Demo connection to Odoo
info =... | <python><odoo><xml-rpc> | 2025-04-23 15:53:24 | 1 | 423 | Marco Di Gennaro |
79,588,998 | 6,439,229 | How to prevent error on shutdown with Logging Handler / QObject? | <p>In order to show logging messages in a PyQt GUI, I'm using a custom logging handler that sends the logRecord as a <code>pyqtSignal</code>.<br />
This handler inherits from both <code>QObject</code> and <code>logging.Handler</code>.</p>
<p>This works as it should but on shutdown there's this error:</p>
<blockquote>
<... | <python><pyqt><python-logging> | 2025-04-23 15:43:43 | 1 | 1,016 | mahkitah |
79,588,983 | 12,415,855 | Parse XML file using selenium and bs4? | <p>i try to parse a xml-file using the following code:</p>
<pre><code>import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium... | <python><xml><selenium-webdriver><beautifulsoup> | 2025-04-23 15:32:38 | 3 | 1,515 | Rapid1898 |
79,588,915 | 8,587,712 | pandas column based on multiple values from other columns | <p>I have a dataframe</p>
<pre><code>df = pd.DataFrame(data={
'a':[1,2,3,4,1,2,3,4,5],
'b':[1,4,2,2,1,2,1,1,2],
'c':[1000, 10, 500, 100,100, 10, 500, 100, 10]
})
</code></pre>
<p>which looks like</p>
<pre><code> a b c
0 1 1 1000
1 2 4 10
2 3 2 500
3 4 2 100
4 1 1 100
5 ... | <python><pandas> | 2025-04-23 14:59:41 | 0 | 313 | Nikko Cleri |
79,588,882 | 6,563,305 | Simple pythonic way to check if a list of dict is a subset of another list of dict? | <p>Is there a simple pythonic way to check if a list of dictionaries is a subset of another list of dictionaries? This can be done via a <code>for</code> loop by checking each item. I'm hoping there's a faster way with built-in methods.</p>
<p>i.e.</p>
<pre><code>maybe_subset = [
{'Key': 'apple', 'Value': '1234'},... | <python> | 2025-04-23 14:43:43 | 3 | 617 | Kent Wong |
79,588,678 | 17,580,381 | Optimum selection mechanism when choosing relevant rows from a dataframe | <p>I have a large Excel spreadsheet. I'm only interested in certain columns. Furthermore, I'm only interested in rows where specific columns meet certain criteria.</p>
<p>The following works:</p>
<pre><code>import pandas as pd
import warnings
# this suppresses the openpyxl warning that we're seeing
warnings.filterwarn... | <python><pandas><openpyxl> | 2025-04-23 12:58:07 | 1 | 28,997 | Ramrab |
79,588,248 | 1,636,349 | Using fork & exec in Python | <p>I wrote a little test program to play around with <code>fork()</code> and <code>exec()</code> in Python, and I got some puzzling results. The program just forks a new process to run whatever is given as the command-line parameters in <code>argv</code>. Here is my code:</p>
<pre><code>import sys
import os
print(&quo... | <python><fork> | 2025-04-23 09:19:33 | 0 | 548 | user1636349 |
79,588,208 | 1,785,448 | Why does `strftime("%Y")` not yield a 4-digit year for dates < 1000 AD in Python's datetime module on Linux? | <p>I am puzzled by an inconsistency when calling <code>.strftime()</code> for dates which are pre-1000 AD, using Python's <code>datetime</code> module.</p>
<p>Take the following example:</p>
<pre class="lang-py prettyprint-override"><code>import datetime
old_date = datetime.date(year=33, month=3, day=28) # 28th March ... | <python><python-datetime> | 2025-04-23 08:54:05 | 2 | 730 | Melipone |
79,588,066 | 7,032,878 | Can I access a SharePoint using Python, when I have username and password with MFA? | <p>Is there any mean to access a SharePoint using an interactive Python script? The conditions are the following:</p>
<ul>
<li>I have username/password for a user that can access the SharePoint online;</li>
<li>There is MFA enabled;</li>
<li>I can't register a new application on Azure, I have to stick only to the user.... | <python><sharepoint> | 2025-04-23 07:29:33 | 0 | 627 | espogian |
79,587,895 | 10,470,463 | Should a tkinter button always have a variable as a name? | <p>I can make a tkinter button like this:</p>
<pre><code>button1 = ttk.Button(root, text = "Button 1", command=lambda: button_click(button1))
</code></pre>
<p>or in a loop like this:</p>
<pre><code>tk.Button(root, text=f"Button {i}", command=lambda x=i: button_click(x)).pack()
</code></pre>
<p>But t... | <python><tkinter><tkinter-button> | 2025-04-23 05:26:23 | 1 | 511 | Pedroski |
79,587,773 | 826,112 | Python file behaviour different when run from different IDE's | <p>A colleague and I were reviewing some student submissions. He likes using IDLE, while I use PyCharm. The student developed their code in PyCharm.
A simplified example of the students work is:</p>
<pre><code>file = open('test_file.txt','w')
file.write('This is a test file.')
print('Completed')
exit()
</code></pre>
... | <python> | 2025-04-23 03:51:09 | 1 | 536 | Andrew H |
79,587,751 | 2,402,098 | MSGraph ImmutableId of a message changes when draft is sent | <p>I am trying to keep track of emails sent using the MSGraph API. If an email is sent using the <a href="https://learn.microsoft.com/en-us/graph/api/message-reply?view=graph-rest-1.0&tabs=http" rel="nofollow noreferrer">Reply</a> endpoint, it understandably does not return the <code>messageId</code> property that ... | <python><microsoft-graph-api> | 2025-04-23 03:11:04 | 0 | 342 | DrS |
79,587,488 | 1,164,295 | Deal Design by Contract to prove a Python script with decorators | <p>I have a dockerized <a href="https://deal.readthedocs.io/index.html" rel="nofollow noreferrer">Deal</a> that I can successfully run using</p>
<pre class="lang-bash prettyprint-override"><code>docker run -it -v `pwd`:/scratch -w /scratch --rm deal python3 -m deal prove deal_demo_cat.py
</code></pre>
<p>which produces... | <python><design-by-contract> | 2025-04-22 21:42:26 | 0 | 631 | Ben |
79,587,464 | 10,441,038 | Fastest way to convert results from tuple of tuples to 2D numpy.array | <p>I'm training my AI model with a huge data set, so that it's impossible to preload all the data into memory at the beginning. I'm currently using psycopg2 to load data from a Postgresql DB during training.</p>
<p>I need to convert the sample data into numpy.ndarry, while psycopg2 returns data in a tuple of tuples, wh... | <python><postgresql><numpy><tuples><psycopg2> | 2025-04-22 21:27:14 | 2 | 2,165 | Leon |
79,587,407 | 984,532 | Read data from sheet1 and output filtered data on sheet2 | <p>Is it possible?
Or it seems that each sheet is a separate environment?</p>
<p>CONTEXT:
A clean way to read 200 rows of data (and 30+ columns) is using something like</p>
<p><code>df=xl("A:BS", headers=True)</code></p>
<p>So a user wants a filtered view of my data on sheet2.
e.g., <code>df[df['project'] =='... | <python><excel> | 2025-04-22 20:39:26 | 1 | 12,034 | userJT |
79,587,376 | 2,276,054 | How to pass Python interpreter parameters -O/-OO to a console-script? ([project.scripts]) | <p>In <code>pyproject.toml</code>, I have the following section:</p>
<pre><code>[project.scripts]
work = "mypackage.worker_app:main"
</code></pre>
<p>This means that after activating virtual environment, I can simply type <code>work</code>, and this will execute method <code>main()</code> from class <code>wor... | <python><pyproject.toml> | 2025-04-22 20:11:04 | 0 | 681 | Leszek Pachura |
79,587,372 | 12,871,587 | How to perform a nearest match join without reusing rows from the right DataFrame? | <p>I'm working with two Polars DataFrames and want to join them based on the nearest match of a numeric column, similar to how join_asof works with strategy="nearest". However, I’d like to ensure that each row from the right DataFrame is used at most once, meaning once it's matched to a row from the left, it ... | <python><python-polars> | 2025-04-22 20:05:55 | 1 | 713 | miroslaavi |
79,587,363 | 3,124,150 | Format np.float64 without leading digits | <p>I need to format <code>np.float64</code> floating values without leading digits before the dot, for example <code>-2.40366982307</code> as <code>-.240366982307E+01</code>, in python.<br />
This is to allow me to write in RINEX 3.03 the values with 4X, 4D19.12 formats. I have tried <code>f"{x:.12E}"</code> ... | <python><numpy><string-formatting> | 2025-04-22 19:56:16 | 1 | 947 | EmmanuelMess |
79,587,261 | 9,669,142 | Python - stress test all 24 CPU cores | <p>I want to understand better how to work with multiprocessing in Python, and as a test, I wanted to set all cores in the CPU at 100%. First, I tested it with a CPU that has 8 cores, and all cores went to 100%, so that worked. Then I tested it with a CPU that has 24 cores, but for some reason it only sets 8 cores to 1... | <python><multiprocessing> | 2025-04-22 18:56:04 | 0 | 567 | Fish1996 |
79,587,218 | 547,231 | Array slicing inside `jax.lax.while_loop yields error` "array boolean indices must be concrete" | <p>Please consider the following toy example, which mimics what I'm trying to achieve in my real-world application:</p>
<pre><code>import flax
import jax
def op(x):
return x - 1
@flax.struct.dataclass
class adaptive_state:
i: jax.numpy.ndarray
key: jax.random.PRNGKey
def loop(carry):
state, active_ma... | <python><python-3.8><jax> | 2025-04-22 18:26:56 | 2 | 18,343 | 0xbadf00d |
79,587,213 | 8,741,781 | Why is Gunicorn creating its socket with the wrong group even though the parent directory has the setgid bit? | <p>I'm running Gunicorn under <code>Supervisor</code> as a non-root user (<code>webapps</code>) and trying to create a Unix domain socket at <code>/run/webapps/gunicorn.sock</code>. I want the socket to be group-owned by <code>webapp_sockets</code> so that nginx (running as <code>www-data</code> and added to <code>weba... | <python><gunicorn><supervisord> | 2025-04-22 18:25:17 | 1 | 6,137 | bdoubleu |
79,587,044 | 4,907,639 | Setting up a mixed-integer program in python | <p>I am trying to figure out if it is possible to configure a specific problem as a mixed-integer program. I think I am able to structure it as a continuous non-linear optimization problem, but would like to see if a MIP works better.</p>
<p>The basic idea is that there are several systems comprised of multiple element... | <python><optimization><mixed-integer-programming> | 2025-04-22 16:41:43 | 1 | 2,109 | coolhand |
79,586,806 | 6,282,576 | Using pytest and mongoengine, data is created in the main database instead of a test one | <p>I've installed these packages:</p>
<pre><code>python -m pip install pytest pytest-django
</code></pre>
<p>And created a fixture:</p>
<pre class="lang-py prettyprint-override"><code># core/services/tests/fixtures/checkout.py
import pytest
from bson import ObjectId
from datetime import datetime
from core.models.src... | <python><django><mongodb><pytest><mongoengine> | 2025-04-22 15:12:32 | 0 | 4,313 | Amir Shabani |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.