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 β |
|---|---|---|---|---|---|---|---|---|
78,289,545 | 6,197,439 | PyQt5 SetWindowIcon from SVG from qrc resources rendered blurry/pixelized/wrong? | <p>Consider this example:</p>
<p>File <code>logo.svg</code></p>
<pre class="lang-svg prettyprint-override"><code><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xml:space="preserve"
id="svg201"
x="0"
y="0"
style=&q... | <python><svg><pyqt5><icons><qt5> | 2024-04-07 22:50:10 | 0 | 5,938 | sdbbs |
78,289,299 | 5,121,282 | Using variable from __init__.py in main does not work | <p>I want to use a dictionary created in the init.py file:</p>
<pre><code>import requests
request = requests.get('http://cloudconfig:8001/msprueba/desarrollo')
request.raise_for_status()
all_config = request.json()
property_sources = all_config['propertySources']
config = {}
for sources in property_sources:
f... | <python> | 2024-04-07 21:05:02 | 1 | 940 | Alan Gaytan |
78,289,229 | 984,621 | Scrapy - one spider, two pipelines. How to decide which one will be used? | <p>I have a spider that processes data from a website. On this website, there are products and manufacturers. The structure of the spider looks like this:</p>
<pre><code>import scrapy
from sreality.itemsloaders import ProductLoader, ManufacturerLoader
from sreality.items import Product, Manufacturer
class ProductSpide... | <python><scrapy><scrapy-pipeline> | 2024-04-07 20:39:48 | 0 | 48,763 | user984621 |
78,288,966 | 5,257,430 | Create A stacked bar plot in facetgrid | <p>I would like to plot using seaborn and pandas. The dataframe is below.</p>
<pre><code>d = {'cutoff': ['>6']*8+ ['>7']*8 +['>8']*8,
'month': ['3m','3m','3m','3m','6m','6m','6m','6m'] * 3,
'outcome': ['D','D','I','I']*6,
'count': ['0','>0']*12,
'proportion': [0.25, 0.75, 0.4, 0.6, 0.3, ... | <python><pandas><seaborn> | 2024-04-07 19:01:28 | 0 | 621 | pill45 |
78,288,154 | 108,390 | How to pipe expressions from a list of expressions in Python Polars | <p>I cannot get my head around this.
Say that I have a dictionary of regexes and replacement strings that I want to replace, and if none of these regexes are matched (when returns False) I want to resume with the next when statement.</p>
<p>So, instead of this way, that does not check for data in "new data".... | <python><python-polars> | 2024-04-07 14:31:29 | 2 | 1,393 | Fontanka16 |
78,287,997 | 2,986,153 | plot density ridge plot with conditional fill color in python | <p>I am trying to produce density ridge plots in python where the fill is conditional on the x-values as has been done in this post: <a href="https://stackoverflow.com/questions/78200593/plot-continuous-geom-density-ridges-with-conditional-fill-color">plot continuous geom_density_ridges with conditional fill color</a><... | <python><seaborn> | 2024-04-07 13:38:40 | 1 | 3,836 | Joe |
78,287,949 | 1,234,173 | Video file too Small while trying to upload a reel on facebook API | <p>i am trying to upload a reel (MP4, 16 seconds, and 9 MB) using facebook graph API, but i get the following error:</p>
<p>Failed to upload reel: {'error': {'message': 'The video file you tried to upload is too small. Please try again with a larger file.', 'type': 'OAuthException', 'code': 382, 'error_subcode': 136302... | <python><facebook><facebook-graph-api> | 2024-04-07 13:21:13 | 1 | 385 | Augustus |
78,287,834 | 433,261 | Filter entries by tags | <p>I have two tables with a relationship</p>
<pre><code>class Patient(db.Model):
__tablename__ = "patient"
id = db.Column(db.UUID(as_uuid=True), primary_key=True, unique=True, server_default=sql.text("gen_random_uuid()"))
name = db.Column(db.String)
tags = db.relationship('PatientTag... | <python><flask><sqlalchemy> | 2024-04-07 12:41:24 | 1 | 751 | Hadi |
78,287,827 | 1,172,907 | How to ignore functions matching pattern in pyright? | <p>Despite ignoring <code>vcr</code>, pyright still reports an error. Why am I still seeing this error:</p>
<pre class="lang-none prettyprint-override"><code>[Pyright] Arguments missing for parameters "instance", "args", "kwargs" (3:5)
</code></pre>
<pre class="lang-py prettyprint-override... | <python><pyright> | 2024-04-07 12:39:50 | 2 | 605 | jjk |
78,287,788 | 11,520,306 | Produce to Confluent Kafka Topic with SASL_SSL and OAUTHBEARER mechanism using python client | <p>I'm trying to produce one message to a topic in my RBAC-enabled and TLS-enabled Confluent Kafka cluster. My solution only works partially. I'm seeking help to successfully publish a message to the topic using the <a href="https://docs.confluent.io/kafka-clients/python/current/overview.html" rel="nofollow noreferrer"... | <python><apache-kafka><confluent-platform><confluent-kafka-python> | 2024-04-07 12:25:08 | 0 | 558 | Moritz Wolff |
78,287,484 | 268,581 | Stacked bar chart from dataframe | <h1>Program</h1>
<p>Here's a small Python program that gets tax data via the treasury.gov API:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import treasury_gov_pandas
# ----------------------------------------------------------------------
df = treasury_gov_pandas.update_records(
url = 'h... | <python><pandas> | 2024-04-07 10:33:00 | 3 | 9,709 | dharmatech |
78,287,471 | 16,389,095 | Python/Flet: RuntimeError: asyncio.run() cannot be called from a running event loop | <p>I'm trying to use an <a href="https://github.com/flet-dev/examples/blob/main/python/apps/counter/counter.py" rel="nofollow noreferrer">example</a> provided by the <strong>Flet</strong> developers written in Python Flet framework.
After having installed Flet, and downloaded the example, I tried to run it into Spyder ... | <python><runtime-error><python-asyncio> | 2024-04-07 10:28:03 | 1 | 421 | eljamba |
78,287,455 | 6,805,396 | Adding 'pass' instruction breaks PyCharm iterating through a set | <p>Found a strange behaviour with PyCharm in debugging mode.
Suppose we have a code:</p>
<pre><code>a = {'a', 'b', 'c'}
for el in a:
print(el)
pass
</code></pre>
<p>If you but a break on a 'pass' line and try the code in debugging mode you got an error:</p>
<pre><code>Process finished with exit code -1073741819... | <python><debugging><pycharm> | 2024-04-07 10:19:36 | 0 | 609 | Vlad |
78,287,270 | 18,205,996 | How to send confirmation emails and scheduled emails in Django | <p>I'm working on a Django project involving a custom user registration form. My goal is to implement a two-step email notification process upon form submission:</p>
<p>Immediate Email Confirmation: Automatically send a customized email to the user immediately after they submit the form.
Scheduled Email Notification: S... | <python><django><forms><email> | 2024-04-07 09:16:29 | 1 | 597 | taha khamis |
78,287,245 | 6,187,792 | Encrypting columns in Databricks using Python while retaining original datatype | <p>I'm working on a data security project in Databricks using Python, and I need to encrypt certain columns in a DataFrame while ensuring that the encrypted columns retain their original datatype. I've followed below article, but struggling to find a solution that preserves the datatype integrity post-encryption.</p>
<... | <python><pyspark><encryption><databricks><azure-databricks> | 2024-04-07 09:07:41 | 1 | 1,340 | practicalGuy |
78,287,188 | 9,137,547 | Pylance complaining for sklearn.datasets.load_iris() | <p>I am using Pylance with <code>Type Checking Mode: Basic</code> and I am loading the iris dataset with <a href="https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_iris.html" rel="nofollow noreferrer">sklearn.datasets.load_iris()</a>.</p>
<pre><code>from sklearn.datasets import load_iris
def main... | <python><types><scikit-learn><pylance><pyright> | 2024-04-07 08:47:01 | 1 | 659 | Umberto Fontanazza |
78,287,134 | 11,824,828 | Using OpenAI API for answering questions about csv file | <p>I'm starting with OpenAI API and experimenting with langchain. I have a .csv file with approximately 1000 rows and 85 columns with string values. I found some beginner article that I followed and have a colab notebook with the following code:</p>
<pre><code>txt_file_path = '/content/drive/My Drive/Colab Notebooks/pr... | <python><artificial-intelligence><openai-api><langchain><retrieval-augmented-generation> | 2024-04-07 08:27:26 | 2 | 325 | vloubes |
78,287,128 | 6,225,526 | What is python equivalent of qweibull in MathCAD? | <p>I want to get the x value for the given quantile while the data is weibull distributed. Mathcad has <code>qweibull</code> and scipy has <code>scipy.stats.norm.ppf(q)</code> for normal distribution.</p>
<p>However, I dont find <code>scipy.stats.weibull.ppf(q, c)</code></p>
<p>How can I achieve this?</p>
| <python><numpy><scipy><mathcad> | 2024-04-07 08:25:50 | 1 | 1,161 | Selva |
78,287,117 | 9,108,781 | How to restart a Python script from within itself? | <p>There seem to be at least two ways to restart a Python script. What's the difference between these two ways, and when to use which? Thanks a lot!
One way:</p>
<pre><code>import sys
import os
def restart_script():
python = sys.executable
os.execl(python, python, *sys.argv)
def main():
print("Starti... | <python><python-3.x> | 2024-04-07 08:20:33 | 1 | 943 | Victor Wang |
78,286,931 | 5,218,497 | Create user in congito during external signup by providing default phone_number if it doesn't exist | <p>How to update phone number to default value if phone_number doesn't exist during signup.
Our cognito cannot have phone_number to have null so it needs to have default value.</p>
<p>The below code is written in <strong>Pre sign-up Lambda trigger</strong></p>
<p>Below code doesn't seem to work when signup during Exter... | <python><amazon-web-services><amazon-cognito> | 2024-04-07 07:01:17 | 0 | 2,428 | Sharath |
78,286,871 | 3,628,240 | Webscraping JavaScript Table with Selenium and Beautiful Soup | <p>I'm trying to scrape this website: <a href="https://www.globusmedical.com/patient-education-musculoskeletal-system-conditions/resources/find-a-surgeon/" rel="nofollow noreferrer">https://www.globusmedical.com/patient-education-musculoskeletal-system-conditions/resources/find-a-surgeon/</a></p>
<p>It appears that the... | <python><selenium-webdriver><web-scraping><beautifulsoup> | 2024-04-07 06:38:28 | 2 | 927 | user3628240 |
78,286,768 | 6,115,999 | Trying to use keras pipeline: Unrecognized keyword arguments passed to Dense: | <p>I installed keras-ocr from pip and am running this:</p>
<p><code>import keras_ocr</code></p>
<p>I get this error here but I've read I can just ignore it:</p>
<pre><code>2024-04-07 01:32:55.323689: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructio... | <python><tensorflow><keras> | 2024-04-07 05:40:02 | 4 | 877 | filifunk |
78,286,690 | 20,386,110 | Godot: CharacterBody2D or Area2D for an object that needs collision AND to queue_free? | <p>I'm working on the game <em>Breakout</em> which is a game similar to <em>Pong</em> where a ball bounces off a paddle and you have to aim in order to hit a brick. When you hit the brick you score a point and the brick disappears. Each of my bricks is an <code>Area2D</code> because I need access to the <code>on_body_e... | <python><game-development><godot><gdscript> | 2024-04-07 04:54:12 | 1 | 369 | Dagger |
78,286,674 | 726,730 | PyQt5 - QtWebEngineWidgets error while trying to open a web page | <p>For some reason, when i am trying to open a web page using QtWebEngineWidgets i show this error: <code>[10316:10636:0407/073627.994:FATAL:tsf_text_store.cc(52)] Failed to initialize CategoryMgr.</code></p>
<p>MRE:</p>
<p>file: test.py</p>
<pre class="lang-py prettyprint-override"><code># -*- coding: utf-8 -*-
from P... | <python><pyqt5><qwebengineview><qwebenginepage><qwebengine> | 2024-04-07 04:45:19 | 0 | 2,427 | Chris P |
78,286,494 | 908,328 | A question about Python's pop and what does the grammar have to say? | <p>This is something I tried out in <code>ipython</code> the behavior is quite clear: when creating the dictionary in lines 3 and 6, the dictionaries are created as if invoked by <code>dict(**kwargs)</code> and the kwargs are being processed left to right but is it a CPython implementation or is the behavior actually ... | <python><dictionary><grammar> | 2024-04-07 02:49:14 | 1 | 1,123 | pbhowmick |
78,286,424 | 11,170,350 | Trouble with Django Authentication: Instead of showing templates it show admin page | <p>I'm currently learning Django authentication and have encountered an issue with customizing HTML templates. Instead of displaying my custom templates, Django redirects me to the admin dashboard.</p>
<p>For instance, when I modify <code>LOGOUT_REDIRECT_URL</code> to <code>logout</code> and <code>name</code> in <code>... | <python><django><django-authentication> | 2024-04-07 02:07:27 | 3 | 2,979 | Talha Anwar |
78,286,353 | 1,886,237 | Writing a pandas dataframe with large vector column | <p>I have a pandas dataframe with 4 columns as shown below. The <strong>text_vector</strong> column contains vectors that are 1500 dimensions:</p>
<p><a href="https://i.sstatic.net/rvBFY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rvBFY.png" alt="enter image description here" /></a></p>
<p>When I wri... | <python><pandas><dataframe><dataformat> | 2024-04-07 01:19:05 | 1 | 2,170 | Michael Szczepaniak |
78,285,775 | 22,418,446 | How to remove inactive devices when scanning for Bluetooth devices using PyBluez? | <p>I'm developing a Python application to scan for nearby Bluetooth devices using <code>PyBluez</code>. I'm using the <code>discover_devices</code> function to discover devices within a certain duration, and I've set <code>lookup_names</code> and <code>lookup_class</code> parameters to True to retrieve the device names... | <python><bluetooth><pybluez> | 2024-04-06 20:23:59 | 0 | 1,160 | msamedozmen |
78,285,729 | 416,035 | Inline python script in cmake execute_process fails on windows | <p>I'm working on a project that uses cmake, and it is failing while trying to locate my python interpreter. cmake v3.26 is being run under cmd.exe on Windows 10.</p>
<p>The error message is</p>
<pre><code>CMake Error at <project_path>/cmake/share/cmake-3.26/Modules/FindPython/Support.cmake:2175 (list):
list GE... | <python><cmake> | 2024-04-06 20:03:29 | 0 | 786 | RFairey |
78,285,698 | 4,089,351 | Python Jupyter Notebook kernel in VSCode not defaulting to prior settings after attempting to run a prior version of Python | <p>Background: I was getting comfortable running without a glitch Jupyter Notebooks in VSC. However, I tried to run an old NB, and it didn't run due to some deprecated commands in the code. So I tried using an older version of Python. All this within VSC. It didn't recognize <code>install numpy as np</code>, which I do... | <python><visual-studio-code><jupyter-notebook> | 2024-04-06 19:46:06 | 1 | 4,851 | Antoni Parellada |
78,285,601 | 16,363,897 | Rolling standard deviation of all columns, ignoring NaNs | <p>I have the following dataframe:</p>
<pre><code>data = {'a': {1: None, 2: 1, 3: 7, 4: 2, 5: 4},
'b': {1: None, 2: 2, 3: 2, 4: 9, 5: 6},
'c': {1: None, 2: 2.0, 3: None, 4: 7.0, 5: 4.0}}
df = pd.DataFrame(data).rename_axis('day')
a b c
day
1 NaN NaN NaN
2 1.0 2.0 2.0
3 7.0 2... | <python><pandas><dataframe><numpy> | 2024-04-06 19:10:45 | 2 | 842 | younggotti |
78,285,559 | 7,576,157 | Airflow PYTHONPATH | <p>I am catching the error:</p>
<pre><code>ModuleNotFoundError: No module named 'scripts.marketing_functions'
</code></pre>
<p>Project structure example.</p>
<pre><code>scripts/
βββ__init__.py
βββ marketing_functions.py
βββ marketing/
βββ some_script.py # Here my marketing_functions.py is used
dags/
βββ my_dag... | <python><bash><airflow><airflow-2.x> | 2024-04-06 18:58:41 | 1 | 505 | ΠΠ»Π΅ΠΊΡΠ°Π½Π΄Ρ Π¨Π°ΠΏΠΎΠ²Π°Π»ΠΎΠ² |
78,285,290 | 10,035,190 | how to filter huge csv file by pandas | <p>I have a 10GB csv file <code>data/history_{date_to_be_searched}.csv</code>. it has more than 27000 zip codes. On the basis of zip code I have to filter the csv file then each filtered file I have to upload to azure blob storage.</p>
<p>I am taking data in chunks of size 1 000 000 like this <code>for chunk in pd.read... | <python><pandas><csv><large-data><large-files> | 2024-04-06 17:27:47 | 1 | 930 | zircon |
78,285,251 | 9,827,719 | Python Session in 2nd gen Google Cloud Function - RuntimeError: The session is unavailable because no secret key was set | <p>How can I use sessions in a Google Cloud Function 2nd gen?</p>
<p>When I try to set a session I get a error.</p>
<pre><code>session['logged_in'] = True
</code></pre>
<p>Gives error:</p>
<blockquote>
<p>RuntimeError: The session is unavailable because no secret key was
set. Set the secret_key on the application to s... | <python><google-cloud-functions> | 2024-04-06 17:15:51 | 1 | 1,400 | Europa |
78,285,241 | 15,453,560 | Extracting dates from a sentence in spaCy | <p>I have a string like so:</p>
<pre><code>"The dates are from 30 June 2019 to 1 January 2022 inclusive"
</code></pre>
<p>I want to extract the dates from this string using spaCy.</p>
<p>Here is my function so far:</p>
<pre><code>def extract_dates_with_year(text):
doc = nlp(text)
dates_with_year = []
... | <python><regex><nlp><spacy><named-entity-recognition> | 2024-04-06 17:12:39 | 1 | 657 | Muhammad Kamil |
78,284,969 | 1,307,851 | Difference across rows in Pandas DataFrame | <p>How do I create <code>df2</code> directly using <code>df</code> as input? I can't wrap my head around it...</p>
<pre><code>>>> import pandas as pd
>>> data = {'Year': [1990, 1990, 1990, 2022, 2022, 2022], 'City': ['Paris', 'Berlin', 'Lisbon', 'Paris', 'Berlin', 'Lisbon'], 'Population': [2.15, 3.40,... | <python><pandas> | 2024-04-06 15:46:40 | 3 | 694 | Fredrik P |
78,284,936 | 8,030,794 | Using group_by in pandas but with condition | <p>I have dataframe</p>
<pre><code>data = {'time': ['10:00', '10:01', '10:02', '10:02', '10:03','10:04', '10:06', '10:10', '10:15'],
'price': [100, 101, 101, 103, 101,101, 105, 106, 107],
'volume': [50, 60, 30, 80, 20,50, 10, 40, 40]}
</code></pre>
<p>I need to group by this df by every 5 minutes and pr... | <python><pandas><group-by> | 2024-04-06 15:35:34 | 1 | 465 | Fresto |
78,284,892 | 7,959,614 | ThreadPoolExecutor and time-outs for individual threads | <p>I have the following code that yields a <code>TimeoutError</code> for the third <code>result</code>.</p>
<pre><code>import time
from concurrent.futures import ThreadPoolExecutor, TimeoutError
def sleeping(i):
time.sleep(i)
return f'slept {i} seconds'
with ThreadPoolExecutor(max_workers=1) as exe:
tr... | <python><multithreading><concurrent.futures> | 2024-04-06 15:22:38 | 1 | 406 | HJA24 |
78,284,761 | 275,552 | Altair sorting not working properly on faceted chart | <p>I have some faceted bar graphs displaying the amounts of different colors in different paintings.</p>
<pre><code>base = alt.Chart(df).mark_bar().encode(
x=alt.X(
'color',
title='',
),
y=alt.Y(
'amount',
title='',
),
color=alt... | <python><altair> | 2024-04-06 14:35:54 | 1 | 16,225 | herpderp |
78,284,173 | 1,341,024 | Flask-Security: CSRF SESSION Token Missing in Angular Request | <p>I have a Flask application using the Flask-Security extension. Here's how my app is initialized:</p>
<pre class="lang-py prettyprint-override"><code>app = Flask(__name__)
app.config['DEBUG'] = True
CORS(app)
CSRFProtect(app)
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'
app.config['SECRET_KEY'] = os.environ.get(&q... | <python><angular><flask><flask-security><flask-session> | 2024-04-06 11:22:51 | 2 | 344 | CodeCannibal |
78,284,003 | 14,923,149 | Connecting dendrograms in matplotlib | <p>I'm currently working on a project where I need to visualize hierarchical clustering dendrograms using matplotlib in Python. I've managed to generate dendrograms for two datasets (X1 and X2) and plotted them side by side. However, I'm facing difficulties in connecting the dendrograms together.</p>
<p>Previously I ha... | <python><matplotlib><dendrogram> | 2024-04-06 10:23:41 | 1 | 504 | Umar |
78,283,850 | 11,422,610 | AttributeError: 'NoneType' object has no attribute 'hexdigest' with sha256 | <pre><code>#!/usr/bin/env python3
from hashlib import sha256
def produce_digest_char_by_char(word):
d=sha256();print(d.hexdigest())
for b in word:
#d=d.update(b.encode()):print(d.hexdigest())#AttributeError: 'NoneType' object has no attribute 'hexdigest'
d.update(b.encode());print(d.hexdigest(... | <python><python-3.x><hash><sha256><hashlib> | 2024-04-06 09:31:09 | 0 | 937 | John Smith |
78,283,816 | 6,197,439 | What do to, when pyinstaller sys._MEIPASS does not work? | <p>Here is an example, which in fact works, and so it does not actually illustrate my problem, but just to set a basis for discussion:</p>
<pre><code>mkdir C:/test/testpyinst
cd C:/test/testpyinst
</code></pre>
<p>Here I have <code>main.py</code>:</p>
<pre class="lang-python prettyprint-override"><code>#!/usr/bin/env p... | <python><python-3.x><pyinstaller> | 2024-04-06 09:19:30 | 1 | 5,938 | sdbbs |
78,283,494 | 106,019 | OCR with varying background colors and low contrasts? | <p>I'm trying to convert images to text using pytesseract. It works well for images with white background and black text, but it fails for images with less contrast and varying colors.</p>
<p>I have tried to put together all situations into one image. In most situations, the text and background each has a single color.... | <python><ocr><tesseract><python-tesseract><image-preprocessing> | 2024-04-06 06:51:01 | 1 | 765 | thomasa88 |
78,283,302 | 292,233 | Understanding pytorch performance | <p>I am running code to pass an input image (as pytorch tensor) through a convolutional network (<code>torchvision.models.segmentation.deeplabv3_mobilenet_v3_large()</code> with a modified head). On the returned output tensor I perform a bit of post-processing. Surprisingly, the post-processing (applying non-maximum su... | <python><performance><pytorch> | 2024-04-06 05:09:46 | 0 | 11,663 | Philipp |
78,283,262 | 1,521,645 | How to mock environment variable that uses equality operator | <p>Given the following code, I am unable to properly patch the os.environ "USE_THING".
I believe this is because USE_THING is a constant created before the test runs, so I cannot reassign the value. If I define USE_THING within the do_thing method, I can patch it no problem, but I believe the instantiation wi... | <python><unit-testing><python-unittest.mock> | 2024-04-06 04:38:14 | 1 | 379 | bort |
78,283,007 | 1,487,336 | how to write a function with unknown number of input in python? | <p>I would like to write a function keeping the common index of input dataframes. I could write it as follows for 2 dataframes:</p>
<pre><code>def get_df_common_index(df1, df2):
common_index = df1.index.intersection(df2.index)
return df1.loc[common_index], df2.loc[common_index]
</code></pre>
<p>My question is h... | <python> | 2024-04-06 02:08:03 | 0 | 809 | Lei Hao |
78,282,984 | 401,736 | Unable to run certain python command from Cmake | <p>I'm having following python code</p>
<pre><code> cmd = [
"cmd.exe", "/c",
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/vcvarsx86_amd64.bat",
"^&^&", "set", "PATH", ">",... | <python><windows><cmake> | 2024-04-06 01:55:30 | 1 | 970 | StNickolay |
78,282,930 | 8,723,227 | Why are there double parentheses around my Python virtual environment in Visual Studio Code? | <p>After updating Visual Studio Code to version 1.88.0, I opened one of my Python projects and noticed that there are double parentheses in my virtual environment: <code>((env) )</code>.</p>
<p>I'm using the Python extension v2024.4.0.</p>
<p><a href="https://i.sstatic.net/qA7Ap.png" rel="nofollow noreferrer"><img src=... | <python><visual-studio-code><virtualenv> | 2024-04-06 01:25:37 | 4 | 723 | Piero |
78,282,813 | 480,118 | pandas: sorting multi-level columns | <p>I have the following pandas dataframe:</p>
<pre><code>import pandas as pd
data1 = [['01/01/2000', 101, 201, 301],
['01/02/2000', 102, 202, 302],
['01/03/2000', 103, 203, 303],]
df1 = pd.DataFrame(data1, columns=['date', 'field1', 'field2', 'field3'])
df1 = df1.set_index('date')
data2 = [['01/01/2000'... | <python><pandas> | 2024-04-06 00:12:21 | 1 | 6,184 | mike01010 |
78,282,781 | 4,061,339 | Python polars - how to aggregate dataframes | <h1>Objective</h1>
<p>To efficiently aggreate the returned dataframes of a function in a Polars dataframe in Python.</p>
<h1>Environment</h1>
<ul>
<li>Windows 10</li>
<li>Python 3.9.18</li>
<li>Polars 0.20.18</li>
</ul>
<h1>What I did so far</h1>
<p>I want the equivalent of this code (this is a dummy code).</p>
<pre><c... | <python><windows><dataframe><group-by><python-polars> | 2024-04-05 23:54:29 | 1 | 3,094 | dixhom |
78,282,780 | 7,318,488 | Polars: How to prevent: polars.exceptions.InvalidOperationError: `min` operation not supported for dtype `null` | <p>Hi I have the following data frame with only one row, that can contain an empty list (with only one value null).</p>
<p>When I try to get the min over the list, and the one row dataframe does contain only an empty list I run in the following error</p>
<pre><code>polars.exceptions.InvalidOperationError: `min` operati... | <python><python-polars><data-wrangling><dtype> | 2024-04-05 23:54:18 | 0 | 1,840 | BjΓΆrn |
78,282,533 | 2,893,053 | Pass 'self' into a function defined via python exec in a class method | <p>I have the following piece of code:</p>
<pre class="lang-py prettyprint-override"><code>class A:
def __init__(self):
self.name = "foo"
def hello(self):
exec("def func():\n print(self.name)")
import pdb; pdb.set_trace()
aa = A()
aa.hello()
</code></pre>
<p>Running ... | <python><exec> | 2024-04-05 22:10:09 | 2 | 1,528 | zkytony |
78,282,512 | 2,893,053 | Access function defined via python exec in class method | <p>Consider the following code snippet:</p>
<pre class="lang-py prettyprint-override"><code>class A:
def hello(self):
exec("def func():\n print('hello world')")
func()
import pdb; pdb.set_trace()
</code></pre>
<p>In the pdb shell, I create an instance of <code>A</code> and call <code>hell... | <python><exec> | 2024-04-05 22:04:13 | 0 | 1,528 | zkytony |
78,282,483 | 22,407,544 | No such file or directory: 'ffmpeg' in Django/Docker | <p>I run my Django code in Docker. I run transcription software that requires ffmpeg to function. However I've been getting the error <code>[Errno 2] No such file or directory: 'ffmpeg'</code> whenever I try to run my code.</p>
<p>Here's my views.py:</p>
<pre><code>def initiate_transcription(request, session_id):
.... | <python><django><docker><ffmpeg> | 2024-04-05 21:52:34 | 1 | 359 | tthheemmaannii |
78,282,287 | 305,466 | Why am I getting incompatible pointer to integer conversion initializing 'Py_ssize_t' on an M1 mac? | <p>Recently (April 2024), I started seeing the following error in a couple of builds on my M1 mac:</p>
<pre><code>"error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *' [-Wint-conversion]"
</code></pre>
<p>How do I fix it?</p>
| <python><apple-m1> | 2024-04-05 20:48:39 | 1 | 1,417 | sshevlyagin |
78,282,231 | 17,800,932 | Directly import modules in a Poetry project from a non-Poetry managed module | <p>I have an existing codebase that I am working in, and for any new code, I am using <a href="https://python-poetry.org/" rel="nofollow noreferrer">Poetry</a> to manage the modules, dependencies, etc. For existing code, I am slowly migrating over code, but this is obviously a bit tedious and time consuming. There is s... | <python><python-import><python-module><python-poetry> | 2024-04-05 20:32:36 | 1 | 908 | bmitc |
78,282,162 | 1,568,658 | In pycharm, what is the test_xxx.http file, for a fastapi project? | <p>After creating a <code>fastapi</code> project, via <code>pycharm</code>, I got such a file:</p>
<p><strong>test_main.http:</strong></p>
<pre><code># Test your FastAPI endpoints
GET http://127.0.0.1:8000/
Accept: application/json
###
GET http://127.0.0.1:8000/hello/User
Accept: application/json
</code></pre>
<p>and... | <python><pycharm><fastapi> | 2024-04-05 20:14:28 | 1 | 25,717 | Eric |
78,281,985 | 4,766 | How do install gst-python on macOS to work with the recommended GStreamer installers? | <p>I'm trying to get the following to work on macOS 14.4.1 on an M1 Pro:</p>
<pre><code>$ python3
Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import s... | <python><macos><gstreamer><pygobject> | 2024-04-05 19:24:43 | 2 | 150,682 | Daryl Spitzer |
78,281,846 | 6,674,599 | How to call `time` from python with its stderr returned only | <p>How can I capture the output of <code>/usr/bin/time</code> only, if the command itself outputs stderr?</p>
<pre class="lang-py prettyprint-override"><code>import subprocess
print(subprocess.run('/usr/bin/time -p foo', capture_output=True, shell=True).stderr.decode())
</code></pre>
<p>prints</p>
<pre><code>foo_stderr... | <python><time><subprocess><command><stderr> | 2024-04-05 18:45:59 | 1 | 2,035 | Semnodime |
78,281,829 | 1,981,797 | Polars: Select element of list using column value as index | <p>Code to generate the toy dataset:</p>
<pre><code>import itertools
import numpy as np
import polars as pl
first = 30
second = 50
third = 40
data = {
"a": np.concatenate(
(np.repeat(1, first), np.repeat(2, second), np.repeat(3, third))
),
"b": np.concatenate(
(
... | <python><dataframe><python-polars> | 2024-04-05 18:40:38 | 1 | 641 | Maxwell's Daemon |
78,281,803 | 825,227 | Elementwise subtract one dataframe from another with different number of columns | <p>I have a dataframe:</p>
<p><strong>df</strong></p>
<pre class="lang-none prettyprint-override"><code> East Midwest Mountain
2015-01-02 737 849 152
2015-01-09 685 774 142
2015-01-16 631 711 136
2015-01-23 595 677 134
</code></pre>
<p>That I'd like to su... | <python><pandas> | 2024-04-05 18:34:28 | 1 | 1,702 | Chris |
78,281,781 | 1,209,675 | Python C extensions - Can't put float into array | <p>I'm learning C and trying to write an extension to convert COO sparse data to a dense array. (I know SciPy can do it.) But I'm stuck. I can declare the integers for the 2D pointer into the array, but I can't get the float value that I want to put into the array. I don't understand what the difference is between m... | <python><c><numpy><cpython> | 2024-04-05 18:29:54 | 0 | 335 | user1209675 |
78,281,668 | 16,770,405 | Nonlocal variable not updated when return value from recursive function is not bound to a variable: | <p>Came across some pattern similar to this for a leetcode problem. Basically, both functions sums a list a recursively using a nonlocal value. The unassigned value only updates <code>res</code> once it seems.</p>
<pre class="lang-py prettyprint-override"><code>def assigned_sum(l: list[int]):
res = 0
def recurse(i... | <python><recursion><python-nonlocal> | 2024-04-05 18:04:53 | 1 | 323 | Kevin Jiang |
78,281,530 | 22,407,544 | Docker error: failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 2 | <p>I've recently cloned my repository to a new device. My repository is run in a docker environment. However, despite having one successful docker image build on this device, whenever I try to build a new Docker image(by running <code>docker build . </code>) I encounter this error when installing in requirements.txt:</... | <python><django><docker><pip><pytorch> | 2024-04-05 17:36:10 | 0 | 359 | tthheemmaannii |
78,281,505 | 13,392,257 | S3 Minio: An error occurred (400) when calling the HeadBucket operation: Bad Request"} | <p>I am trying to run S3 environment locally</p>
<p>I created docker-compose dile</p>
<pre><code>services:
# docker-compose up is not working on MacOS because of EFK services
s3:
image: minio/minio
command: server --console-address ":9001" /data
container_name: minio-s3
ports:
- &qu... | <python><amazon-s3><minio> | 2024-04-05 17:27:10 | 1 | 1,708 | mascai |
78,281,416 | 219,159 | Several file descriptors vs seeking all the time | <p>I'm pondering a design for a parser library that needs to maintain several (on the order of 10) read streams to the same file with independent positions. I could do it by opening the file several times, or opening once and seeking whenever needed. On general grounds, which will provide better performance? The resour... | <python><performance><optimization><file-io><posix> | 2024-04-05 17:05:13 | 0 | 61,826 | Seva Alekseyev |
78,281,300 | 10,311,694 | Redshift query with regexp_replace works in Redshift console but not Python lambda | <p>One of the fields in my Redshift table is structured like <code>{event_type} 2024-01-01</code>, so I am using <code>regexp_replace</code> to remove the date from the event type. I am calling Redshift via a Python Lambda like this</p>
<pre><code>client = boto3.client("cluster-name", aws_region, aws_access_k... | <python><sql><regex><aws-lambda><amazon-redshift> | 2024-04-05 16:36:16 | 3 | 451 | Kevin2566 |
78,281,273 | 8,694,474 | create and use python venv from cmake | <p>we are using cmake and invoking some python packages (like conan) from cmake.
However latest python 3.12 seams to enforce using venv.
I did some searching and found this interesting article
<a href="https://discourse.cmake.org/t/possible-to-create-a-python-virtual-env-from-cmake-and-then-find-it-with-findpython3/113... | <python><cmake><python-venv> | 2024-04-05 16:30:19 | 1 | 1,041 | JuliusCaesar |
78,281,062 | 8,799,005 | position streamlit buttons horizontaly next to each others | <p>How to position two buttons in the same line, next to each other.
I had the two following failing attempts.</p>
<p><strong>Attempt 1</strong>: The buttons do not get placed side by side</p>
<pre class="lang-py prettyprint-override"><code> st.markdown('<div style="display: inline-block;">', unsafe_... | <python><streamlit> | 2024-04-05 15:51:32 | 1 | 376 | Sou |
78,281,016 | 464,277 | Multivariate forecast in NeuralProphet | <p>I'm trying to build a global model to predict two time series at the same time. The code below works with no error. But the forecast dataframe has all NaN corresponding to one of the two IDs (i.e. there are two time series). The yhat values are also all NaN. Am I doing something wrong or missing?</p>
<pre><code>m = ... | <python><machine-learning><time-series><facebook-prophet> | 2024-04-05 15:44:18 | 0 | 10,181 | zzzbbx |
78,280,954 | 1,321,547 | Add timezone based on Column Value | <p>I have a polars Dataframe with two columns: a string column containing datetimes and an integer column containing UTC offsets (for example -4 for EDT). Essentially the Dataframe looks like this:</p>
<pre><code>>>> data
shape: (2, 2)
βββββββββββββββββββββββ¬βββββββββββ
β Datetime β Timezone β
β ---... | <python><python-polars> | 2024-04-05 15:32:45 | 2 | 313 | upapilot |
78,280,423 | 5,707,850 | How to refresh/trigger all content within a Tableau Schedule | <p>On Tableau you can run a schedule, but I'm looking to run a schedule via python/tabcmd or other method after our daily data operations are complete. This would allow us the ability to add and remove content to the schedule without having to code for that specific content. Currently each data source or workbook ID ha... | <python><tableau-api> | 2024-04-05 13:59:08 | 1 | 359 | Caleb |
78,280,227 | 419,399 | Matplotlib issue with subplots - 'Axes' object has no attribute 'is_first_col' | <pre><code>import matplotlib.pyplot as plt
fig, ax = plt.subplots(1,2)
import pandas as pd
df = pd.DataFrame([1,2,3])
df.plot(ax=ax[0])
</code></pre>
<p>matplotlib: '3.8.4'
pandas: '1.2.0'
python:3.11.0</p>
<p>results in this error:</p>
<pre><code>------------------------------------------------------------------------... | <python><pandas><matplotlib> | 2024-04-05 13:27:34 | 1 | 1,230 | Intelligent-Infrastructure |
78,279,924 | 1,973,451 | pytorch: autograd with tensors generated by arange | <p>I want to compute the gradient of a function in several points. However, If I use tensors generated with <code>torch.arange</code> the gradient is not computed. Instead, using classical tensors it works. Why?</p>
<pre><code>import torch
from torch import tensor
def l(w_1,w_2):
return w_1*w_2
w_1 = tensor(3., r... | <python><pytorch><gradient><tensor><autograd> | 2024-04-05 12:36:30 | 1 | 1,441 | volperossa |
78,279,823 | 1,194,864 | How exactly the forward and backward hooks work in PyTorch | <p>I am trying to understand how exactly code-wise the hooks operate in <code>PyTorch</code>. I have a model and I would like to set a forward and backward hook in my code. I would like to set a hook in my model after a specific layer and I guess the easiest way is to set a hook to this specific <code>module</code>. Th... | <python><pytorch><hook> | 2024-04-05 12:15:14 | 2 | 5,452 | Jose Ramon |
78,279,748 | 5,175,802 | snowflake-connector-python[pandas] write_pandas creates duplicate records in table | <p>I am attempting to copy data into snowflake on an AWS Lambda. I have a situation right now where I have a dataframe that has no duplicates in it. I verify this by checking my dataframe like so:</p>
<p><code>df.duplicated().any()</code> and verify that it returns <code>False</code></p>
<p>I then double check by filte... | <python><pandas><aws-lambda><snowflake-cloud-data-platform> | 2024-04-05 11:57:25 | 1 | 3,626 | Jake Boomgaarden |
78,279,743 | 2,417,709 | How to identify whether the partition belongs to OS (Linux) or not using python | <p>I have a requirement to identify only the operating system volumes using python. Is there any method in "psutil" to identify that? Currently I'm thinking of to read fstab, based on the 6th column (if not "0") we have to identify whether the partition belongs to OS or just data. Can some through ... | <python><linux><psutil><fstab> | 2024-04-05 11:55:28 | 0 | 311 | Naga |
78,279,592 | 4,277,485 | create columns dynamically depending on string structure in Python | <p>To give background on my project, comparing two documents which has nested <code>JSON</code> structure using <code>deepDiff</code> in python. During comparison, if values of a field are changed, those are written to a DataFrame for analysis.</p>
<p>Example data change:</p>
<pre><code>"values_changed": {
... | <python><pandas><dataframe><dictionary> | 2024-04-05 11:25:16 | 3 | 438 | Kavya shree |
78,279,361 | 7,695,845 | How to parallelize a loop over a multi dimensional array with numba? | <p>I am trying to implement a numerical scheme over a multi-dimensional array with <code>numba</code>. For each dimension, there is a corresponding 1D vector with some values I use in my scheme. As a starting point, I had a 2D array with vectors of x values and y values. My scheme is similar to this:</p>
<pre class="la... | <python><numpy><parallel-processing><numba> | 2024-04-05 10:44:41 | 0 | 1,420 | Shai Avr |
78,279,136 | 11,934,706 | "ImportError: cannot import name 'triu' from 'scipy.linalg'" when importing Gensim | <p>I am trying to use Gensim, but running <code>import gensim</code> raises this error:</p>
<pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/dist-packages/gensim/__init__.py", line... | <python><scipy><gensim> | 2024-04-05 10:01:46 | 3 | 1,490 | CodeRed |
78,278,918 | 6,768,058 | Can't run await with async methods in llama index | <p>I try the code below which is from <a href="https://docs.llamaindex.ai/en/stable/examples/evaluation/batch_eval/" rel="nofollow noreferrer">https://docs.llamaindex.ai/en/stable/examples/evaluation/batch_eval/</a>.</p>
<p>I came across an error of</p>
<blockquote>
<p>SyntaxError: 'await' outside function</p>
</blockq... | <python><async-await><python-asyncio><large-language-model> | 2024-04-05 09:24:16 | 1 | 423 | LUSAQX |
78,278,746 | 9,236,505 | Plot for every subgroup of a groupby | <pre><code> data = {0: {'VAR1': 'A', 'VAR2': 'X', 'VAL1': 3, 'VAL2': 1},
1: {'VAR1': 'A', 'VAR2': 'X', 'VAL1': 4, 'VAL2': 1},
2: {'VAR1': 'A', 'VAR2': 'X', 'VAL1': 5, 'VAL2': 1},
3: {'VAR1': 'A', 'VAR2': 'Y', 'VAL1': 3, 'VAL2': 2},
4: {'VAR1': 'A', 'VAR2': 'Y', 'VAL1': 4, 'VAL2': 2},
5: {'VAR1': 'A', 'VAR2': 'Y', ... | <python><python-3.x><pandas><matplotlib> | 2024-04-05 08:47:58 | 1 | 336 | Paul |
78,278,716 | 1,900,384 | Thread-safe read from a fastly growing list? | <p>Let's say, we have one list shared across two Python processes:</p>
<ul>
<li>a <strong>data logger process</strong>, which fastly appends (immutable) objects to the list, and</li>
<li>a <strong>collector process</strong>, which occasionally reads the currently available list for further processing.</li>
</ul>
<p>How... | <python><list><multithreading><thread-safety> | 2024-04-05 08:41:06 | 0 | 2,201 | matheburg |
78,278,705 | 10,200,497 | How to select first N number of groups based on values of a column conditionally and groupby two columns? | <p>This is a follow up to this <a href="https://stackoverflow.com/questions/78278506/how-to-select-first-n-number-of-groups-based-on-values-of-a-column-conditionally#78278536">post</a></p>
<p>This is my DataFrame:</p>
<pre><code>df = pd.DataFrame(
{
'a': [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, ... | <python><pandas><group-by> | 2024-04-05 08:39:06 | 2 | 2,679 | AmirX |
78,278,659 | 448,317 | Is mypy contradicting itself or is it just me? Mypy is giving an error on a variable but not on the excatc same literal | <p>The following code:</p>
<pre><code>def foo(bar: dict[ int | float , int | float]) -> None:
pass
foo({1: 1})
bas = {1: 1}
foo(bas)
</code></pre>
<p>Triggers the following mypy error:</p>
<pre><code>6: error: Argument 1 to "foo" has incompatible type "dict[int, int]"; expected "dict[in... | <python><mypy><python-typing><pyarrow> | 2024-04-05 08:30:19 | 1 | 864 | Troels Blum |
78,278,506 | 10,200,497 | How to select first N number of groups based on values of a column conditionally? | <p>This is my DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 10, 22],
'b': [1, 1, 1, -1, -1, -1, -1, 2, 2, 2, 2, -1, -1, -1, -1],
'c': [25, 25, 25, 45, 45, 45, 45, 65, 65, 65, 65, 40, 40, 30, 30]
}
)
</code></... | <python><pandas><dataframe> | 2024-04-05 07:56:33 | 2 | 2,679 | AmirX |
78,278,504 | 11,328,614 | trio and rich, live update, abandon_on_cancel, console cursor vanishes | <p>I like to combine <code>async</code> code with a <code>rich</code> tui in a small tool to observe some hardware states.<br />
The tool should run endlessly after it has been started so if somebody wants to control the hardware he does not need to start the tool again and again. However, during development I would li... | <python><multithreading><asynchronous><console-application><rich> | 2024-04-05 07:55:28 | 0 | 1,132 | WΓΆr Du Schnaffzig |
78,278,082 | 6,480,751 | Python zlib.compress not accepting 3 arguments? | <p>System: Windows</p>
<p>Trying to run zlib.compress(save_file_data, level=1, wbits=-zlib.MAX_WBITS) but I keep getting</p>
<pre><code>return zlib.compress(save_file_data, level=1, wbits=-zlib.MAX_WBITS)
TypeError: compress() takes at most 2 arguments (3 given)
</code></pre>
<p>even though <a href="https://docs.python... | <python><python-zlib> | 2024-04-05 06:22:26 | 1 | 365 | Kilbo |
78,277,473 | 11,402,025 | load testing for burst requests using locust | <p>I am trying to simulate a burst request in locust of 1200 with request rate of 600 per second</p>
<pre><code>@task
def send_burst_request(self):
def send_request():
self.client.get(
f"/api/v1/test",
)
# Adjust the number of reques... | <python><performance><testing><load><locust> | 2024-04-05 02:30:00 | 0 | 1,712 | Tanu |
78,277,200 | 395,857 | How can I download a HuggingFace dataset via HuggingFace CLI while keeping the original filenames? | <p>I downloaded a <a href="https://huggingface.co/datasets/huuuyeah/MeetingBank_Audio" rel="nofollow noreferrer">dataset</a> hosted on HuggingFace via the <a href="https://huggingface.co/docs/huggingface_hub/main/en/guides/cli" rel="nofollow noreferrer">HuggingFace CLI</a> as follows:</p>
<pre><code>pip install hugging... | <python><download><dataset><huggingface-datasets> | 2024-04-05 00:18:13 | 3 | 84,585 | Franck Dernoncourt |
78,277,014 | 4,697,337 | Typing of the `__getitem__` method of numpy array subclasses | <p>Let's consider a subclass of <code>numpy</code>'s <code>ndarray</code> class:</p>
<pre><code>import numpy as np
class ArraySubClass(np.ndarray):
def __new__(cls, input_array: np.ndarray):
obj = np.asarray(input_array).view(cls)
return obj
</code></pre>
<p>Then, taking a slice of an <code>ArraySu... | <python><numpy><python-typing><pyright> | 2024-04-04 22:58:06 | 1 | 396 | Kevlar |
78,277,012 | 20,302,906 | Field 'id' expected a number but got dict when seeding database django | <p>I'm looking for a way to store a question fetched from an external API to be stored in a model called <code>Question</code>. My <code>views.py</code> module does that by requesting data based on user's question difficulty choice, then renders what's fetched in a form. It's a pretty straightforward method but for som... | <python><django><model> | 2024-04-04 22:57:50 | 1 | 367 | wavesinaroom |
78,276,978 | 8,838,303 | Python: Shuffle not working in class initialiser | <p>I want to write a class "SomeClass" that stores a shuffled version of the list it is initialised with. However, the list is shuffled in exactly the same way for every instance of my class. Could you please tell me what I am doing wrong?</p>
<pre><code>import random
class SomeClass:
def __init__(self... | <python><class><random><shuffle> | 2024-04-04 22:49:33 | 1 | 475 | 3nondatur |
78,276,904 | 9,108,781 | How to get all docs and their corresponding embeddings from a Chromadb collection | <p>I'd like to get all docs and their corresponding embeddings from a collection for a pairwise cosine similarity calculation to identify very similar documents. Using the following function,</p>
<pre><code>def get_docs_and_embeddings(collection):
results = collection.get(include=["documents", "embed... | <python><chromadb> | 2024-04-04 22:26:03 | 0 | 943 | Victor Wang |
78,276,864 | 16,912,844 | Python Nesting Async and Sync Context Manager | <p>I was wondering when using mixed ContextManager (async and sync) in Python, is there any standard to say if async should be inside sync, or vice versa? Maybe it depends on what the scenario is, is there best practice to say when async should be inside sync or sync inside async?</p>
<p>put async within the sync cm:</... | <python><contextmanager> | 2024-04-04 22:11:19 | 0 | 317 | YTKme |
78,276,786 | 5,374,161 | Gemini Python API Deadline Exceeded | <p>I have been trying to use Google's Gemini API using python, and I am running into continuous <code>504 Deadline Exceeded</code>. This is also not a one of thing as well, I have tried 20+ times using python SDK and it failed everytime, while curl returned in 5-6 seconds everytime.</p>
<p>I initially thought this was... | <python><large-language-model><google-ai-platform><google-gemini><google-cloud-ai> | 2024-04-04 21:49:24 | 2 | 667 | Krishh |
78,276,722 | 13,354,617 | How to constrain a QRubberBand within an image/QLabel? | <p>I'm creating an image viewer in pyqt5, it's all working. I need to add a cropping function where the user can draw a rectangle over the image and the rectangle will be used later.</p>
<p>Currently, it's drawing the QRubberBand perfectly, but I want it to stay inside the image and not draw outside the image like this... | <python><pyqt><pyqt5> | 2024-04-04 21:32:31 | 1 | 369 | Mhmd Admn |
78,276,702 | 22,221,987 | Tkinter event loop can't process some key combinations when use <KeyPress> event | <p>Here is the code from another <a href="https://stackoverflow.com/questions/39606019/tkinter-using-two-keys-at-the-same-time">question</a>, which demonstrates the problem very well (I just found it when I was looking for solution for my problem).<br />
So, when you press some specific key combination, the last (3rd k... | <python><tkinter><events><keyboard><tk-toolkit> | 2024-04-04 21:27:02 | 0 | 309 | Mika |
78,276,576 | 58,553 | Return http status code 401 when login with invalid credentials | <p>How would i go about changing an <code>django</code> application that uses <code>allauth</code> so that it returns 401 response when invalid login credentials are provided?</p>
<p>I have tried to put custom logic in a custom <code>ModelBackend</code> but found no way to actually modify the response status code there... | <python><django><django-allauth> | 2024-04-04 20:56:48 | 1 | 38,870 | Peter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.