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,479,335 | 525,865 | How to automate scraping wikipedia-info box specifically and print the data using python for more (other) wiki page? | <p>How to automate scraping wikipedia info box specifically and print the data using python for any wiki page? My task is to automate printing the wikipedia infobox data. And that said i found out that the infobox is a typical wiki-part. so if i get familiar on this part - then i have learned alot - for future tasks - ... | <python><pandas><web-scraping><beautifulsoup><request> | 2024-05-14 16:03:29 | 1 | 1,223 | zero |
78,479,313 | 1,650,379 | Updating a Plotly FIgureWidget "in situ" in a Dash app | <p>Consider the following toy Python class, which can occasionally fetch additional data from some source, and updates its display:</p>
<pre><code># minimum_working_example.py
import plotly.graph_objects as go
import random
class MyData:
def __init__(self):
self.mydata = []
self.figure = go.FigureW... | <python><jupyter-notebook><plotly><ipython><plotly-dash> | 2024-05-14 15:58:27 | 1 | 392 | rob |
78,478,992 | 12,256,384 | Call Databricks notebook without specifying parameters from an external notebook | <p>I have main notebook <strong>main_notebook</strong>. I am going to call an external notebook <strong>notebook1</strong> which has 2 parameters <code>param1</code> and <code>param2</code>, but I do not want to specify parameters name, I know parameters orders. I want something like this:</p>
<pre><code>dbutils.notebo... | <python><databricks><databricks-notebook> | 2024-05-14 15:03:41 | 0 | 1,214 | Beso |
78,478,961 | 2,954,547 | IPython --profile option works with `jupyter console` but not JupyterLab | <p>I have the following (redacted) <code>my-project/kernel.json</code> in one of the standard Jupyter kernel paths:</p>
<pre class="lang-json prettyprint-override"><code>{
"argv": [
".../my-project/.local/conda/bin/python",
"-Xfrozen_modules=off",
"-m",
"ip... | <python><jupyter-notebook><jupyter><ipython><jupyter-console> | 2024-05-14 14:58:05 | 1 | 14,083 | shadowtalker |
78,478,896 | 20,122,390 | How can I run Pandas (Python) scripts from Go? | <p>I have several csv files that I must process using the Pandas (Python) library but I would like to be able to take advantage of Go's concurrency model to process several files concurrently/parallel. So I guess each goroutine should start a Python interpreter in order to execute Pandas code. I have the csv file loade... | <python><pandas><go> | 2024-05-14 14:47:44 | 0 | 988 | Diego L |
78,478,844 | 2,543,065 | Python FastApi - Import error: No module named 'routers' | <p>i am trying to build FastAPi with my custom api provider.
Following the fastapi guide by documentation.
When i run this command : <code>fastapi run</code></p>
<p>It gives an error: <code>ERROR Import error: No module named 'routers'</code></p>
<p>I have double checked <strong>init</strong>.py file is exist under ... | <python><fastapi> | 2024-05-14 14:40:06 | 1 | 726 | balron |
78,478,825 | 1,422,096 | Numpy slicing on a zero-padded 2D array | <p>Given a 2D Numpy array, I'd like to be able to pad it on the left, right, top, bottom side, like the following pseudo-code. Is there anything like this already built into Numpy?</p>
<pre><code>import numpy as np
a = np.arange(16).reshape((4, 4))
# [[ 0 1 2 3]
# [ 4 5 6 7]
# [ 8 9 10 11]
# [12 13 14 15]]
... | <python><numpy><multidimensional-array><padding><numpy-ndarray> | 2024-05-14 14:36:38 | 3 | 47,388 | Basj |
78,478,782 | 4,317,190 | Is there a way to force a command's argument to read from stdin instead of straight from the command line? | <p>I have a python script I'm running that I don't have the ability to change. Here's how I tried running it:</p>
<pre><code>python my_script.py --username <username> --password -
</code></pre>
<p>Just to see if python would allow me to use the <code>-</code> to read from stdin somehow, but it didn't, the script ... | <python><bash><command-line> | 2024-05-14 14:27:59 | 1 | 351 | Ezra Henley |
78,478,754 | 7,217,960 | __del__ method execution order different when dealing with exception before call to del | <p>I'm using Python 3.8.10 on Windows.</p>
<p>The code below prints what I expect to the console:</p>
<pre><code>import gc
class Myclass():
def my_method(self):
raise Exception("something bad happened.")
def __del__(self):
print("__del__exectuted.")
print("first inst... | <python><del> | 2024-05-14 14:24:14 | 0 | 412 | Guett31 |
78,478,574 | 3,289,890 | Investigating discrepancies in TensorFlow and PyTorch performance | <p>In my pursuit of mastering PyTorch neural networks, I've attempted to replicate an existing TensorFlow architecture. However, I've encountered a significant performance gap. While TensorFlow achieves rapid learning within 25 epochs, PyTorch requires at least 250 epochs for comparable generalization. Despite meticulo... | <python><tensorflow><machine-learning><pytorch><neural-network> | 2024-05-14 13:54:26 | 1 | 1,008 | Boris L. |
78,478,521 | 9,548,525 | A regex line to remove whitespaces unless within double quotes, taking into account escaped double quotes | <p>I am parsing some game config files using Python and putting it all in dictionaries. It seemed to all work well until I encountered the following edge-case:</p>
<pre><code>random_owned_controlled_state = {
create_unit = {
division = "name = \"6. Belarusian Red Riflemen\" division_template... | <python><regex><parsing><text-processing> | 2024-05-14 13:46:49 | 1 | 360 | lrdewaal |
78,478,409 | 562,697 | pylint invalid-name warning for override methods | <p>I have a Python (3.12.3) script that uses PyQt6 to make a simple GUI. pylint returns the following warning:</p>
<pre><code>C0103: Method name "paintEvent" doesn't conform to snake_case naming style (invalid-name)
</code></pre>
<p>This method is an override (even has the <code>@override</code> decoration fr... | <python><pylint> | 2024-05-14 13:26:23 | 0 | 11,961 | steveo225 |
78,478,148 | 2,697,895 | How to replicate the dynamic stdout of a command? | <p>I am working on a Raspberry Pi OS, and I make this Python script to run a command and capture it's output. It works fine for commands that outputs text in a sequential way. But when I try to run commands that use dynamic updates, like <code>apt-get update</code> that display a progres percentage, it fails to capture... | <python><linux><stdout> | 2024-05-14 12:37:09 | 0 | 3,182 | Marus Gradinaru |
78,477,934 | 18,910,865 | How to pip install from a text file skipping unreachable libraries | <p>I'm currently in a scenario where I need to install the following:</p>
<pre class="lang-bash prettyprint-override"><code>pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2.1.3/requirements.txt
</code></pre>
<p>What happens is that the library <code>scipy</code> is not available for som... | <python><pip><scipy> | 2024-05-14 11:59:02 | 1 | 522 | Nauel |
78,477,709 | 647,852 | Django-tables2: Populate table with data from different database tables (with model.inheritance) | <p>I want to show data from different database tables on a django-tables2 table.</p>
<p>I have several apps with each app having some database tables (with each table in its own file). Project structure:</p>
<pre><code> --project
-all
-overview
</code></pre>
<p>all/models/compound.py</p>
<pre><code> cla... | <python><django><join><django-tables2> | 2024-05-14 11:18:30 | 1 | 471 | Natalie |
78,477,704 | 1,283,984 | oauth example of bearer jwt token missing validation token belongs to user by not storing mapping on server side? | <p>wrt <a href="https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/" rel="nofollow noreferrer">https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/</a> dont we have to ensure token belongs to same user ?</p>
<p>I see code has login to generate token (authenticate_user). on client side some where (localsto... | <python><fastapi> | 2024-05-14 11:17:12 | 1 | 358 | Miten |
78,477,604 | 4,429,265 | Kafka consumers in FastAPI -> different services, different consumer, same producers | <p>I have gone through these questions and some others, but unfortunately, I could not find an answer for my specific case even after reading the linked documents. Therefore, I believe this question is not a duplicate.</p>
<p><a href="https://stackoverflow.com/questions/35561110/can-multiple-kafka-consumers-read-same-m... | <python><apache-kafka><fastapi><aiokafka> | 2024-05-14 11:01:39 | 1 | 417 | Vahid |
78,477,470 | 11,198,558 | Django form problem on Model object and redirect | <p>I'm facing 2 problems when creating Form in Django:</p>
<ol>
<li>Problem on redirect after submitting Form</li>
<li>Model object is not iterable</li>
</ol>
<p>Specifically, I'm creating feedback form and all my code is as below. There are 4 files and using <code>crispy_form</code> to show the form in html file. Ever... | <python><django> | 2024-05-14 10:33:58 | 0 | 981 | ShanN |
78,477,442 | 12,789,602 | Dynamic update of add_qty parameter in Odoo eCommerce product details page | <p>I'm customizing an Odoo eCommerce website and I need to modify the add_qty parameter in the product details page dynamically via a URL parameter. I'm extending the WebsiteSale class to achieve this.</p>
<p>Here's my code snippet:</p>
<pre><code>class WebsiteSaleCustom(WebsiteSale):
def _prepare_product_values(se... | <python><odoo><e-commerce><odoo-16><odoo-website> | 2024-05-14 10:29:12 | 1 | 552 | Bappi Saha |
78,477,171 | 2,006,674 | Python testcontainers initialise Postgres with SQL file? | <p>How to init Postgres with SQL file ?</p>
<p>Have found <a href="https://github.com/testcontainers/testcontainers-java/discussions/4841" rel="nofollow noreferrer">https://github.com/testcontainers/testcontainers-java/discussions/4841</a>, but with_init_script not available in python version.</p>
| <python><postgresql><testcontainers> | 2024-05-14 09:42:09 | 1 | 7,392 | WebOrCode |
78,477,073 | 11,251,938 | Annotate django queryset based on related field attributes | <p>Suppose you have this models structure in a django project</p>
<pre><code>from django.db import models
class Object(models.Model):
name = models.CharField(max_length=100)
class ObjectEvent(models.Model):
class EventTypes(models.IntegerChoices):
CREATED = 1, "Created"
SCHEDULED = ... | <python><django><django-queryset> | 2024-05-14 09:27:32 | 1 | 929 | Zeno Dalla Valle |
78,476,875 | 1,942,868 | use dynamic string for model key in django | <p>For exampkle I have tabel like this,</p>
<pre><code>class FormSelector(models.Model):
prefs = models.JSONField(default=dict,null=True, blank=True)
items = models.JSONField(default=dict,null=True, blank=True)
</code></pre>
<p>then in views, I want to do like this,</p>
<pre><code>json = {"prefs":[1,2... | <python><django><model> | 2024-05-14 08:52:24 | 1 | 12,599 | whitebear |
78,476,844 | 13,200,217 | Using singleton instead of using context property breaks translation | <p>I have a Python-QML communication setup using <code>setContextProperty</code> and I am trying to move to a setup that can be parsed by <code>qmllint</code>. As described in the docs (<a href="https://doc.qt.io/qt-6/qtqml-cppintegration-contextproperties.html" rel="nofollow noreferrer">link</a>) using a context prope... | <python><qt><qml><pyside> | 2024-05-14 08:46:02 | 0 | 353 | Andrei Miculiță |
78,476,370 | 1,910,555 | How to create a "Split-Bars" plot in Python with matplotlib? | <p>In the <code>datawrapper.de</code> visualizations service a "Split-Bars" plot is available; and I would like to recreate that visualization plot type (programmatically) in Python using matplotlib (or similar library).</p>
<p>I have a dataset as follows:</p>
<pre><code>A B C D
... | <python><matplotlib><visualization><diagram> | 2024-05-14 07:16:56 | 1 | 2,650 | pds |
78,476,342 | 15,148,870 | Django - Adding more options to AdminTimeWidget | <p>I tried to add more time choices to <code>AdminTimeWidget</code> by overriding <code>DateTimeShortcuts</code> refering to <a href="https://stackoverflow.com/questions/5770973/django-how-to-change-the-choices-of-admintimewidget">this post</a> also another similar posts on SO. My problems is I am getting <code>Uncaugh... | <python><django><django-rest-framework> | 2024-05-14 07:11:47 | 1 | 328 | Saidamir |
78,476,300 | 4,219,264 | Pip install fails for pandas | <p>I am trying to install pandas on a Windows machine but get the following output:</p>
<pre><code>python -m pip install pandas
Collecting pandas
Using cached pandas-2.2.2.tar.gz (4.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done... | <python><pandas><pip> | 2024-05-14 07:04:18 | 2 | 3,966 | Serban Stoenescu |
78,476,128 | 7,194,569 | connect to linked service in Azure Data factory using robot framework | <p>how to connect to <strong>linked service</strong> in Azure Data Factory and run a query there using robot framework</p>
| <python><python-3.x><robotframework><automation-testing> | 2024-05-14 06:28:45 | 0 | 397 | Nikhil |
78,476,039 | 22,213,065 | Just keep color range area in images using python | <p>I have high number of JPG images in specific folder that I want to keep only <code>#c7d296</code> color in my images and fill all other remaining areas in images with <code>white color</code>.<br />
for this I can't use Photoshop because I have high number of JPG images and it get me a lot of time! (about <code>2900... | <python><opencv><photoshop> | 2024-05-14 06:08:47 | 1 | 781 | Pubg Mobile |
78,475,685 | 3,102,968 | Why is the path not resolving to an absolute path for the data_dir that is passed as method parameter? | <p>I have the following project structure in a Python project:</p>
<pre><code>> nn-project
-.env
- data
- raw
- boston_housing_price
> - src
> - models
> - bird-model
> - env.py
> - train_model.py
</code></pre>
<p>I have in my .env file, the following:</p>
<p... | <python> | 2024-05-14 04:13:40 | 0 | 15,565 | joesan |
78,475,657 | 2,507,197 | Asyncio multiprocessing communication with queues - only one coroutine running | <p>I have a manager script that's launching some processes, then using two coroutines (one to monitor, one to gather results). For some reason only one coroutine seems to be run, what am I missing? (I don't work with asyncio)</p>
<p><a href="https://i.sstatic.net/3K96CkFl.png" rel="nofollow noreferrer"><img src="https:... | <python><python-asyncio> | 2024-05-14 04:01:48 | 1 | 3,494 | Alter |
78,475,581 | 14,056,352 | Algorithm to filter the address from a large text | <p>I am trying to grab part of this string, I am looking for it to start grabbing the string at the first digit in the string and copy the entire string all the away until the end digits.</p>
<pre><code>import re
string = "['Today is the open house of 1234 High Drive, Denver, COLORADO 80204; open to the Public &q... | <python><regex><algorithm> | 2024-05-14 03:32:29 | 1 | 380 | Josh |
78,475,551 | 2,537,486 | Discontinuous selections with pandas MultiIndex | <p>I have the following <code>DataFrame</code> with <code>MultiIndex</code> columns (the same applies to MultiIndex rows):</p>
<pre><code> import pandas as pd
df = pd.DataFrame(columns=pd.MultiIndex.from_product([['A','B'],[1,2,3,4]]),
data=[[0,1,2,3,4,5,6,7],[10,11,12,13,14,15,16,17],
... | <python><pandas><multi-index> | 2024-05-14 03:16:51 | 1 | 1,749 | germ |
78,475,496 | 3,788,557 | Different results for scipy-minimize using SLSQP dependent upon initalized values | <p>I am using scipy.minimize in an attempt to optmize the inputs to my function.</p>
<p>I have a given amount of budget/hours and 6 inputs where I'm trying to get the highest return from the input mix. Each of these 6 inputs has a non-linear concave-shaped return. That is each of the response curve 'saturates' in a cur... | <python><optimization><scipy><scipy-optimize><scipy-optimize-minimize> | 2024-05-14 02:52:07 | 1 | 6,665 | runningbirds |
78,475,446 | 2,796,170 | FastAPI Custom Router Class - How to get All Router Function Input Parameters | <p>Is there a way to get the input parameters for a fastapi <code>APIRoute</code> function when defining a custom router class (per the <a href="https://fastapi.tiangolo.com/how-to/custom-request-and-route/" rel="nofollow noreferrer">docs</a>)?</p>
<p>For example, in the example below, if the <code>things</code> variab... | <python><fastapi> | 2024-05-14 02:26:10 | 1 | 557 | codeAndStuff |
78,475,426 | 2,307,441 | Pandas map two dataframe based on column name mentioned on the other df and partial match to derive new column | <p>I have two dataframes df1 & df2 as below.</p>
<pre><code>import pandas as pd
data1 = {'Column1': [1, 2, 3],
'Column2': ['Account', 'Biscut', 'Super'],
'Column3': ['Funny', 'Super', 'Nice']}
df1 = pd.DataFrame(data1)
data2 = {'ColumnName':['Column2','Column3','Column1'],
'ifExist':['Acc',... | <python><pandas><dataframe><partial> | 2024-05-14 02:15:15 | 3 | 1,075 | Roshan |
78,475,395 | 1,405,767 | Caching Django Rest Framework function-based view causes permission classes to be ignored | <p>I'm having a strange issue where my function-based view caching seems to be conflicting with the permission classes applied to it. The decorators for the view are as follows:</p>
<pre><code>@cache_page(3600)
@api_view(['GET'])
@permission_classes((APIKeyPermission,))
def function_based_view(request):
# function... | <python><django><django-rest-framework> | 2024-05-14 01:54:55 | 1 | 926 | stackunderflow |
78,475,278 | 4,443,378 | Get duplicate rows in a specific column from dataframe | <p>I have a dataframe df:</p>
<pre><code>num_rows = 5
num_cols = 3
data = [
[10, 20, 30],
[10, 50, 60],
[70, 80, 90],
[20, 30, 10],
[20, 10, 20]
]
columns = [f"Column_{i+1}" for i in range(num_cols)]
df = spark.createDataFrame(data, columns)
|Column_1|Column_2|Column_3|
+--------+-----... | <python><pandas><dataframe><pyspark> | 2024-05-14 00:39:03 | 2 | 596 | Mitch |
78,475,149 | 7,082,628 | Convert HTML to PDF - PDFKit File Size too Large | <p>I have one complete (static, it doesn't rely on calls to the internet) HTML file that's < 900 KB in size, and I am currently using PDF Kit to create a single PDF from it that ends up being about 100 pages long. The PDF is 30-40 mB - which is way too large, frankly - considering each page of the PDF is just text a... | <python><pdf><pdfkit> | 2024-05-13 23:25:59 | 0 | 3,634 | NateH06 |
78,475,106 | 11,196,682 | Should I store start time, end time, and days as separate fields or use a CRON expression in my database? | <p>I am developing a scheduling feature in my application where users can set specific time ranges and days for recurring tasks. For example, a user might configure a task to run every <code>Thursday and Friday from 15:00 to 16:00</code>.</p>
<p>I need to store these schedules in my database and am debating between two... | <python><date><cron> | 2024-05-13 23:05:41 | 0 | 552 | MathAng |
78,475,061 | 11,233,365 | pip install entire Python script as a command line executable via pyproject.toml | <p>I am helping to write a pyproject.toml file for a Python package, and the author has written two Python scripts (not functions, but the script itself) that they would like to use as command-line executables. The folder structure looks as follows:</p>
<pre class="lang-bash prettyprint-override"><code>___ bin
| |__ ... | <python><pip><setuptools><pyproject.toml> | 2024-05-13 22:45:13 | 0 | 301 | TheEponymousProgrammer |
78,475,028 | 7,514,722 | Numpy array in function for A *= B vs A = A*B | <p>The following produces two different behaviors</p>
<pre><code>import numpy as np
def func1 (A, B):
A = A * B
return A
def func2 (A, B):
A *= B
return A
A = np.arange(3, dtype=float)
B = np.full( 3, 2.0 )
C1 = func1 (A, B)
print ( " func 1", C1)
print ( " A after function 1 = &quo... | <python><arrays><numpy> | 2024-05-13 22:29:10 | 0 | 335 | Ong Beng Seong |
78,475,004 | 3,652,584 | Export `stdout` and `stderr` of a single-line bash command to text file while using python module followed by `-m` syntax | <p>I would like to export the <code>stdout</code> and <code>stderr</code> of a bash command to the same text file.</p>
<p>The bash command is a single-line command that calls <code>python3</code> followed by the name of the module and function, followed by three arguments (each using <code>--</code>).</p>
<p>The bash c... | <python><python-3.x><bash><slurm> | 2024-05-13 22:20:08 | 2 | 537 | Ahmed El-Gabbas |
78,474,995 | 2,796,170 | Is there a way to apply a custom route_class for every APIRouter in your fastapi application? | <p>Is there a way to apply a custom <code>route_class</code> for every single APIRouter in your fastapi app? Similar to <a href="https://fastapi.tiangolo.com/how-to/custom-request-and-route/#custom-apiroute-class-in-a-router" rel="nofollow noreferrer">this</a>, but instead of creating each <code>APIRouter</code> insta... | <python><fastapi> | 2024-05-13 22:16:00 | 1 | 557 | codeAndStuff |
78,474,978 | 2,418,793 | Convert svg to png in Python using Inkscape, but nothing works | <p>I want to loop through a folder, take all SVGs and convert them to PNGs, then use OCR to read text from the images.</p>
<p>I know the OCR part of my code works, because I did read text successfully from PNGs. But somehow I can't for the life of me figure out how to first convert all SVGs to PNGs, and then do the OCR... | <python><svg><inkscape> | 2024-05-13 22:08:14 | 0 | 3,172 | Azurespot |
78,474,751 | 3,102,968 | Loading Files and Data from Absolute and Relative Path in Python | <p>I have the following project structure in a Python project:</p>
<pre><code>> nn-project
-.env
> - src
> - models
> - bird-model
> - env.py
> - train_model.py
</code></pre>
<p>I have in my .env file, the following:</p>
<pre><code>PROJECT_ROOT = ../
</code></pre>
<p>In my ... | <python><environment-variables><python-dotenv> | 2024-05-13 20:55:27 | 1 | 15,565 | joesan |
78,474,730 | 3,740,545 | Solve pyomo.common.errors.InfeasibleConstraintException | <p>After running the below code:</p>
<pre><code>from pyomo.environ import *
model = ConcreteModel()
model.q11, model.q12, model.q13, model.q21, model.q22, model.q23, model.q31, model.q32, model.q33 = [Var(bounds=(0.0, 11.0), within=Integers, initialize=0.0) for i in range(9)]
model.s1, model.s2, model.s3 = [Var(bound... | <python><pyomo> | 2024-05-13 20:49:42 | 1 | 7,490 | Franco Piccolo |
78,474,642 | 14,173,197 | Need help in pydantic class output | <p>how to solve this pydantic validation issue?</p>
<pre class="lang-none prettyprint-override"><code>An error occurred while processing your query:
2 validation errors for Answer
answer.TableData
Input should be a valid dictionary or instance of TableData [type=model_type, input_value=None, input_type=NoneType]
For fu... | <python><pydantic><pydantic-v2> | 2024-05-13 20:24:28 | 0 | 323 | sherin_a27 |
78,474,624 | 3,156,085 | Why is `Callable` generic type contravariant in the arguments? | <h1>TL;DR:</h1>
<p>Why is the <code>Callable</code> generic type contravariant in the arguments as stated by the <a href="https://peps.python.org/pep-0483/#covariance-and-contravariance" rel="nofollow noreferrer">PEP 483</a> and how is my analysis of that question (in)accurate? (Said analysis at the bottom of the post)... | <python><contravariance><subtype> | 2024-05-13 20:19:34 | 1 | 15,848 | vmonteco |
78,474,619 | 3,071,350 | How to download an image file using the Google Drive API in a Lambda Function in Python? | <p>I'm trying to download an image file (in a raw .cr2 format, but could change if needed) from Google Drive to AWS Lambda so I can edit using Pillow and upload the edited image back to drive.</p>
<p>I've tried two approaches to download the image following this <a href="https://developers.google.com/drive/api/guides/m... | <python><amazon-web-services><aws-lambda><google-api><google-drive-api> | 2024-05-13 20:18:01 | 0 | 1,962 | filipebarretto |
78,474,573 | 1,914,781 | extract event pairs from multiline text | <p>I would like to extract event pair (start and end marked by <code>+</code> and <code>-</code>). but the pairs maybe not match which means start happen two times then followed the end event.</p>
<p>In below example, event <code>B</code> start happed 2 times, so I wish it output a mismatched pair with <code>nil</code>... | <python><pandas> | 2024-05-13 20:09:40 | 2 | 9,011 | lucky1928 |
78,474,448 | 7,339,624 | OSError: [model] does not appear to have a file named config.json | <p>I want to load a huggingface model. <a href="https://huggingface.co/laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup" rel="nofollow noreferrer">The model</a> I want to load has about 150K downloads so I don't think there is any problem with the model itself.</p>
<p>With the both loading codes below I get t... | <python><machine-learning><deep-learning><huggingface-transformers><huggingface> | 2024-05-13 19:38:47 | 1 | 4,337 | Peyman |
78,474,433 | 719,276 | Inkscape overwrites extensions.xml at startup thus it does not take the python interpreter into account | <p>I followed <a href="https://inkscape.gitlab.io/extensions/documentation/authors/interpreters.html" rel="nofollow noreferrer">this guide</a> to define a custom python interpreter (my system default python), so I edited <code>/Users/amasson/Library/Application Support/org.inkscape.Inkscape/config/inkscape/preferences.... | <python><inkscape> | 2024-05-13 19:35:25 | 0 | 11,833 | arthur.sw |
78,474,388 | 2,986,153 | generate and unnest a list column of random values in polars using np.random.binomial() | <p>I am trying to generate arrays of varying length within a polars dataframe (i.e., a list column).</p>
<p>For each <code>cluster_id</code> I would like to generate a series of 0s and 1s of length <code>trials</code>, which varies by <code>cluster_id</code>:</p>
<pre><code>import numpy as np
import polars as pl
from p... | <python><dataframe><numpy><python-polars> | 2024-05-13 19:24:04 | 1 | 3,836 | Joe |
78,474,175 | 3,063,547 | Problems with build.gradle file when trying to integrate chaquopy into Android Studio Jellyfish | <p>I am trying to integrate chaquopy into Android Studio Jellyfish to allow for the use of Python but there are problems with the module-level build.gradle.kts file and I get these errors when I sync the gradle files:</p>
<pre><code>Unable to load class 'com.android.build.api.variant.Variant'
com.android.build.api.vari... | <python><android><chaquopy> | 2024-05-13 18:30:05 | 1 | 853 | user3063547 |
78,474,144 | 2,444,008 | Getting nested models fields. Serializer error. Object of type QuerySet is not JSON serializable | <p>I'm having a trouble with getting nested object in Django. My main purpose is generating JSON object from nestedDjango objects.</p>
<p>I have models as below:</p>
<pre><code>class SurveyAnswer(models.Model):
id = models.UUIDField(default=uuid.uuid4, unique=True,
primary_key=True, editable=False)
survey... | <python><django><django-rest-framework> | 2024-05-13 18:22:09 | 2 | 1,093 | ftdeveloper |
78,474,040 | 13,142,245 | Save Python dictionary to Json | <p>I'm trying to save a python dictionary to disk as a json file. From this <a href="https://stackoverflow.com/questions/12309269/how-do-i-write-json-data-to-a-file">Q/A</a>, the answer should be</p>
<pre><code>import json
with open('data.json', 'w') as f:
json.dump(data, f)
</code></pre>
<p>However, in my applicat... | <python><json><amazon-web-services><aws-lambda> | 2024-05-13 17:58:52 | 0 | 1,238 | jbuddy_13 |
78,474,029 | 2,138,913 | Drag and Drop a generated file (e.g. MIDI) from a Pyside6 or Qt Application to another application (like a DAW) | <p>I would like to write a simple Qt app (in Python with PySide6) that will generate a midi file such that the user can drag it directly into their DAW (e.g. Reaper, Ableton, Bitwig).</p>
<p>I have got</p>
<pre class="lang-py prettyprint-override"><code> def mousePressEvent(self,e):
if e.button() == Qt.LeftButton:... | <python><qt><drag-and-drop> | 2024-05-13 17:56:56 | 1 | 1,292 | John Allsup |
78,473,894 | 2,977,164 | Yolov8 CNN model in Shiny mixing R and Python | <p>I want to create a Shiny app using R and Python cause the Yolov8 model was developed in Python. But, I try to use my app calling a *py code (<code>yolov8_loader.py</code>) in my app directory and it doesn't work.</p>
<p>In my example, I try:</p>
<pre><code>library(shiny)
library(shinydashboard)
library(rsconnect)
li... | <python><r><shiny><yolo><yolov8> | 2024-05-13 17:29:35 | 1 | 1,883 | Leprechault |
78,473,728 | 1,644,395 | Why is using the "distance.cosine" function from SciPy faster than directly executing its Python code? | <p>I am executing the below two code snippets to calculate the cosine similarity of two vectors where the vectors are the same for both executions and the code for the second one is mainly the code SciPy is running (see <a href="https://github.com/scipy/scipy/blob/1c0bdc44fff93c5c6277a3cb4dac66b4bf07bfcf/scipy/spatial/... | <python><numpy><scipy> | 2024-05-13 16:51:05 | 2 | 349 | joseprupi |
78,473,702 | 243,031 | netaddr remove `is_private` method from BaseIP class in new version | <p>I was using <code>netaddr</code> version <code>0.10.1</code>, and its <code>BaseIP</code> class has method <a href="https://github.com/netaddr/netaddr/blob/0.10.1/netaddr/ip/__init__.py#L158-L186" rel="nofollow noreferrer"><code>is_private</code></a>. We are using that method as <code>if mynetwork.is_private(): # DO... | <python><package><inetaddress> | 2024-05-13 16:46:34 | 0 | 21,411 | NPatel |
78,473,567 | 12,554,903 | WebSockets down stream is Rate-Limited Channels | <p>We have a game which is running on our Django server. All calculations are made on the server.</p>
<p>We use WebSocket to communicate the game data to our front-end clients, which do the rendering.</p>
<p>But we have a problem. With the channels <a href="https://channels.readthedocs.io/en/latest/topics/consumers.htm... | <python><python-3.x><django-channels> | 2024-05-13 16:16:53 | 0 | 365 | Pioupia |
78,473,493 | 19,283,541 | Azure FunctionApp functions not listed when publishing | <p>I've got an Azure Functionapp that works fine locally, but I'm having trouble publishing it to Azure.</p>
<p>I'm using the Python v2 programming model. My project folder looks like this:</p>
<pre><code>project_folder
├── .venv
├── .vscode
├── .funcignore
├── .gitignore
├── my_code_1.py
├── my_code_2.py
├── my_code_3... | <python><azure><azure-functions><azure-cli> | 2024-05-13 16:02:53 | 1 | 309 | radishapollo |
78,473,387 | 9,873,381 | I am using the YOLOv5 model provided by Ultralytics in PyTorch. How can I see which images the model is struggling with? | <p>This is the <a href="https://github.com/ultralytics/yolov5" rel="nofollow noreferrer">YOLOv5</a> implementation I am talking about and <a href="https://github.com/ultralytics/yolov5/blob/master/val.py" rel="nofollow noreferrer">this</a> is the file I am using to test the model.</p>
<p>For some classes, it performing... | <python><pytorch><object-detection><yolov5> | 2024-05-13 15:41:27 | 1 | 672 | Skywalker |
78,473,218 | 7,746,472 | Access network shares from Windows, Mac and Linux | <p>I need to read files from a network share using Python. The Python programm needs to work on macOS, Windows (the systems we use across our team in development) and Linux (which the server is running).</p>
<p>In macOS I can read from the mounted network share like this:</p>
<pre><code>file_path = '//Volumes/data/path... | <python><python-3.x><network-programming> | 2024-05-13 15:11:24 | 1 | 1,191 | Sebastian |
78,473,210 | 10,083,382 | Specify a custom storage path when registering Pandas DataFrame to Azure Blob Storage | <p>I want to register a Pandas data frame as a tabular dataset into Azure Blob Storage. I do not want to create a unique path every time I register a new version of that dataset. Secondly, I need to specify the path which would depend on date whenever I upload a dataset. E.g. if I upload today the path should be <code>... | <python><pandas><azure><azure-blob-storage><azure-machine-learning-service> | 2024-05-13 15:09:39 | 1 | 394 | Lopez |
78,473,182 | 16,155,080 | vLLM + FastAPI async streaming response - fastapi can't handle vllm speed and bottlenecks | <p>I have a chatbot web app with the following components :</p>
<ul>
<li>a frontend</li>
<li>a FastAPI back-end that handles requests</li>
<li>a vLLM <a href="https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/api_server.py" rel="nofollow noreferrer">api_server</a> running a local Llama model on a H100.</l... | <python><streaming><fastapi><vllm> | 2024-05-13 15:04:04 | 0 | 641 | Jules Civel |
78,473,010 | 673,600 | Hugging Face Datasets .map not working as expected | <p>I'm running a function over a dataset, but when I compute this, I seem to replace my existing dataset rather than adding to it. What is going wrong?</p>
<pre><code>dataset_c = Dataset.from_pandas(df_all[0:100])
</code></pre>
<p>That <code>dataset_c</code> looks like:</p>
<pre><code>Dataset({
features: ['_id', 'f... | <python><huggingface><huggingface-datasets> | 2024-05-13 14:36:03 | 1 | 6,026 | disruptive |
78,472,992 | 3,104,974 | Plotly renders complementary colors in Databricks dark mode | <p>Example code:</p>
<pre><code>import numpy as np
import plotly.graph_objs as go
import plotly.io as pio
pio.templates.default = 'plotly_white'
x = np.random.rand(2000)
y = np.random.randn(2000)
trc = go.Scatter(x=x, y=y, mode='markers', marker_color='blue', marker_size=4)
fig.show(renderer='databricks')
</code></... | <python><plotly><databricks> | 2024-05-13 14:32:54 | 0 | 6,315 | ascripter |
78,472,939 | 222,977 | Accessing symbolic tensor values within model or layer call function | <p>This is a follow up to <a href="https://stackoverflow.com/questions/78466591/tensorflow-input-of-varying-shapes?noredirect=1#comment138336725_78466591">Tensorflow input of varying shapes</a>.</p>
<p>In my particular situation, for each training sample, I have three different inputs. Two are scalars and the third is ... | <python><tensorflow><keras> | 2024-05-13 14:22:57 | 0 | 583 | Dan |
78,472,804 | 166,229 | How to parse an optional operator with pyparsing library? | <p>I want to parse strings like <code>alpha OR beta gamma</code> where a missing operator (in this case between <code>beta</code> and <code>gamma</code> a implicit <code>AND</code> is used.</p>
<p>Here is the code I tried:</p>
<pre class="lang-py prettyprint-override"><code>import pyparsing as pp
class Term:
def ... | <python><parsing><pyparsing> | 2024-05-13 14:01:37 | 1 | 16,667 | medihack |
78,472,745 | 11,348,734 | Remove glare noise from an image | <p>I have an image of a steak, and my goal is to calculate its marbling by converting the pixels to red for meat and white for fat. However, I have problems with glare in the image, which hinder the calculation. My code helps to improve it somewhat, but I would like to improve it even further. Here is an example, I hav... | <python><opencv><image-processing> | 2024-05-13 13:54:36 | 0 | 897 | Curious G. |
78,472,697 | 16,859,084 | Robot framework or Python compare dates | <p>I have example date (which must be RFC3339 format)
<code>2021-07-23T14:07:21Z</code></p>
<p>Next there is an endpoint which takes that date lets say
/setdate
Next I want verify whather it was set OK using another endpoint /getdate for examples.
The problem is that this second endpoit returns this date as
<code>2021-... | <python><datetime><robotframework><rfc3339> | 2024-05-13 13:45:56 | 2 | 479 | Tom |
78,472,568 | 3,104,974 | Override trace properties for legend display | <p>How can I force the legend of a plotly 5.9 plot to use different parameters than were defined with the trace?</p>
<p>I have a scatter plot with overlaying low-opacity datapoints, and I want the legend to show the colors in full opacity. Also, I want to increase the marker size in the legend. I have no idea how to ac... | <python><plotly> | 2024-05-13 13:24:33 | 1 | 6,315 | ascripter |
78,472,403 | 105,589 | Using python to decrypt AES-GCM encrypted in JavaScript | <p>I have some code in JavaScript running inside the browser using WebCrypto. It uses AES-GCM to encrypt some data.</p>
<p>I generate a key and then export it to hex, then generate an initialization vector, and then use that to encode some data which I convert to hex as well.</p>
<pre><code>function generateKey() {
... | <javascript><python><aes><webcrypto-api> | 2024-05-13 12:59:15 | 1 | 4,091 | xrd |
78,472,201 | 1,422,096 | Multiple drag and drop rectangular selections on a Matplotlib heatmap / imshow | <p>On a Matplotlib heatmap:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
plt.imshow(np.random.random((16, 16)), cmap='jet', interpolation='nearest')
plt.show()
</code></pre>
<p>is there a built-in Matplotlib feature to do a "rectangular selection" with drag and drop, and have the possibil... | <python><matplotlib><visualization><heatmap> | 2024-05-13 12:24:33 | 1 | 47,388 | Basj |
78,472,200 | 561,341 | How to catch and handle parameter binding errors in Python Flask application? | <p>When an error occurs in the Flask application you can normally handle it either using try / except or by registering an application error handler (<a href="https://flask.palletsprojects.com/en/2.3.x/errorhandling/" rel="nofollow noreferrer">https://flask.palletsprojects.com/en/2.3.x/errorhandling/</a>).<br />
Howeve... | <python><flask> | 2024-05-13 12:23:34 | 2 | 3,152 | Dalibor Čarapić |
78,472,054 | 14,587,041 | Manually color columns in pandas | <p>I have a list of colors that created manually;</p>
<pre><code>colmap = ['green', 'red', 'red', 'red', 'green']
</code></pre>
<p>and also have a pandas dataframe <code>df</code> with same length of my <code>colmap</code></p>
<pre><code>Percent
0 -0.5
1 0.2
2 0.8
3 -0.3
4 0.6
</code></pre>
<p>I want to apply... | <python><pandas><dataframe> | 2024-05-13 11:57:15 | 2 | 2,730 | Samet Sökel |
78,471,983 | 1,613,983 | How do I defer reflection on a view/table without primary keys? | <p>I have a view <code>xyz.MyTable</code> that I'd like to build a model for. It doesn't have a unique column but the combination of columns <code>col1</code> and <code>col2</code> are guaranteed to be unique.</p>
<p>I also don't have access to the engine at declaration, so I need to use deferred reflection. Here is my... | <python><sql-server><sqlalchemy> | 2024-05-13 11:42:22 | 1 | 23,470 | quant |
78,471,887 | 1,584,043 | Selenium Python test doesn't work with Proxy settings | <p>My simple selenium python script to test how proxy fails. How to force webdriver work through proxy connection?</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions ... | <python><google-chrome><selenium-webdriver><proxy><selenium-chromedriver> | 2024-05-13 11:18:47 | 1 | 309 | user1584043 |
78,471,803 | 2,378,625 | "Test framework quit unexpectedly" when running Pytest in PyCharm | <p>I'm running PyCharm Professional 2023.3.4 on an Ubuntu 22.04 machine.</p>
<p>My PyTests run OK from the command line, and from the terminal within PyCharm. But running them directly from PyCharm itself gives the message "Test framework quit unexpectedly", with the error output shown below (in two screensho... | <python><pycharm><pytest> | 2024-05-13 11:02:21 | 1 | 413 | jazcap53 |
78,471,765 | 1,022,138 | Extract Text from a LED Panel Image Using OCR | <p>I have a LED panel from which I am trying to extract text.</p>
<p>I applied some image processing techniques, and here is the result:</p>
<p><a href="https://i.sstatic.net/vCHQpVo7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vCHQpVo7.png" alt="enter image description here" /></a></p>
<p>I want to ... | <python><c#><ocr><tesseract> | 2024-05-13 10:53:33 | 0 | 1,638 | boss |
78,471,751 | 4,343,579 | Can I pass extra arguments into the panda to_sql method callable? | <p>I've been looking at the Pandas Docs and <a href="https://github.com/pandas-dev/pandas/blob/529bcc1e34d18f94c2839813d2dba597235c460d/pandas/io/sql.py#L730" rel="nofollow noreferrer">Pandas Source code</a> of pandas to pass big CSV tables into my PostgreSQL DB in the fastest way possible.</p>
<p>Using pandas.DataFram... | <python><pandas><postgresql><sqlalchemy><psycopg2> | 2024-05-13 10:49:49 | 0 | 586 | Corina Roca |
78,471,671 | 7,112,039 | SQLAlchemy Cascade Delete on Polymorphic M2M relationship | <p>I am building a polymorphic relationship between classes A and B through a Link class.
I want to achieve that when an A object is deleted, the linked B objects are deleted too.
To do that, I defined a relationship between A and Link, with a cascade relationship <code>all, delete</code>, in this way as soon as A is d... | <python><sqlalchemy> | 2024-05-13 10:37:17 | 0 | 303 | ow-me |
78,471,659 | 11,637,422 | Google API Authorisation | <p>I am using some of the basic google API python scripts about accessing drive and creating files etc...</p>
<p>These exact same files worked some months ago, but now I get errors when the tokens are trying to be refreshed. It also does not prompt me to log in.</p>
<p>The setup code is as follows:</p>
<pre><code>def c... | <python><google-api> | 2024-05-13 10:35:38 | 0 | 341 | bbbb |
78,471,457 | 4,247,881 | polars ignore zeros when doing mean() | <p>Not sure why I am finding this so hard.</p>
<p>For the following dataframe I want to calculate the mean for the grouped months like</p>
<pre><code>df = df.group_by("month", maintain_order=True).mean()
</code></pre>
<p>However, I want to ignore 0.0's</p>
<p>I am trying to use polars.Expr.replace
but can't f... | <python><dataframe><python-polars> | 2024-05-13 09:57:26 | 2 | 972 | Glenn Pierce |
78,471,431 | 7,877,397 | Configuring Python Build Slaves without root privilege, but allowing install during build job | <p>I have run into a bit of a chicken and egg issue. The organisation that I worked for use a setup where they setup a docker build slave to be used in Jenkins to serve as a base image where CICD is run.</p>
<p>There is no issue running any installation in this slave image as I can use USER root to <code>python -m pip ... | <python><jenkins><cicd> | 2024-05-13 09:53:18 | 1 | 673 | Chirrut Imwe |
78,471,398 | 14,912,118 | Need to header value in all the files while writing in PySpark for txt files | <p>I need to write header value to all the files in txt format</p>
<p>Here is the code</p>
<pre><code>data = [
("John", 25, "USA"),
("Alice", 30, "Canada"),
("Michael", 35, "USA"),
("Emily", 28, "Australia"),
("Davi... | <python><apache-spark><pyspark> | 2024-05-13 09:49:17 | 0 | 427 | Sharma |
78,471,353 | 1,082,349 | Join claims that I'm attempting to merge object and int64 even though I'm not | <p>I have two dataframes (on a server that I cannot take data out of, so unfortunately no reproducible example), both of which have a column called <code>person2</code>.</p>
<pre><code>>>> group[['person2']].dtypes
person2 object
dtype: object
>>> df_returns[['person2']].dtypes
person2 object
d... | <python><pandas> | 2024-05-13 09:41:02 | 0 | 16,698 | FooBar |
78,471,218 | 390,785 | Programming Error in MySQL LOAD DATA statement when using ENCLOSED BY | <p>I am trying to run a SQL statement using cursor.execute</p>
<pre><code>LOAD DATA LOCAL INFILE
'/home/ubuntu/test.csv'
INTO TABLE app_data
CHARACTER SET UTF8MB4 FIELDS TERMINATED BY ','
IGNORE 1 ROWS ENCLOSED BY ""
LINES TERMINATED BY '\r\n'
</code></pre>
<p>This runs using mysql command line but the ENCLO... | <python><mysql><django> | 2024-05-13 09:16:45 | 0 | 4,440 | sureshvv |
78,471,214 | 4,359,511 | Python pyproject.toml script import failing | <p>I have the following project layout:</p>
<pre><code>
├── README.md
├── requirements.txt
├── pyproject.toml
├── awesome_package/
├── __init__.py
├── __version__.py
└── main_module.py
└── some_packages
</code></pre>
<p>Inside the <code>awesome_package.main_module</code> there is a function that starts ... | <python><python-wheel><pyproject.toml> | 2024-05-13 09:15:53 | 0 | 335 | Alessandro Staffolani |
78,471,188 | 2,059,998 | FastAPI running in IIS - Getting permissionError:[WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions | <p>I'm trying to setup FastAPI in IIS using hypercorn and I keep getting the error</p>
<pre><code>PermissionError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
</code></pre>
<p>I followed these steps <a href="https://github.com/tiangolo/fastapi/discussions/4207#di... | <python><iis><fastapi><hypercorn> | 2024-05-13 09:10:35 | 1 | 520 | Juan Stoppa |
78,471,154 | 1,820,480 | Shipping Large Data With Python Package | <p>I am writing a Python library for scientific calculations. The user should have the possibility to try out these calculations on some test data that (ideally) ships with the Python package. For example:</p>
<pre><code>from mypackge.data import dataset1
from mypackage.science import do_stuff
ds = dataset1() # Downlo... | <python> | 2024-05-13 09:04:07 | 1 | 3,196 | r0f1 |
78,471,104 | 4,777,670 | How to make a function wait for an async operation before executing further code? | <p>I have an async function <code>my_func</code> that performs two operations: <code>f</code> and <code>g</code>. The <code>f</code> operation sends data over a WebSocket and doesn't return anything. The <code>g</code> operation performs some computations and returns a value.</p>
<pre class="lang-py prettyprint-overrid... | <python><websocket><python-asyncio><fastapi> | 2024-05-13 08:54:26 | 0 | 3,620 | Saif |
78,471,100 | 108,390 | Check for equality across N (N>2) columns horizontally in Polars | <p>Assume I have the following Polars DataFrame:</p>
<pre><code>all_items = pl.DataFrame(
{
"ISO_codes": ["fin", "nor", "eng", "eng", "swe"],
"ISO_codes1": ["fin", "nor", "eng", "eng", &q... | <python><python-polars> | 2024-05-13 08:53:16 | 2 | 1,393 | Fontanka16 |
78,471,073 | 5,379,182 | Xray scan shows pip vulnerability in Docker although pip is not installed in the image | <p>When I scan my Docker image for vulnerabilities, Xray detects <a href="https://nvd.nist.gov/vuln/detail/CVE-2018-20225" rel="nofollow noreferrer">CVE-2018-20225</a>
which is raised when using an extra index url in pip. However in my image I completely remove <code>pip</code> after the packages have been installed</p... | <python><docker><pip> | 2024-05-13 08:49:14 | 1 | 3,003 | tenticon |
78,470,913 | 10,710,625 | Generate new Column in Dataframe with Modulo of other Column | <p>I would like to create a new column "Day2" which takes the second digit of column named "Days", so if we have Days equal to 35, we would take the number 5 to be in "Day2", I tried this but it's not working:</p>
<pre><code>DF["Day2"] = DF["Days"].where(
DF... | <python><pandas><dataframe><modulo> | 2024-05-13 08:17:23 | 2 | 739 | the phoenix |
78,470,907 | 11,935,809 | Edgedb in docker starting and stops after migration applied | <p>I am facing odd issue when running <code>egdedb</code> <code>server</code> in Docker: it stops after migration apply without any useful info about what is happening.</p>
<ol>
<li>Docker-compose:</li>
</ol>
<pre class="lang-yaml prettyprint-override"><code>version: '3.9'
volumes:
edgedb_meta:
edgedb_data:
servi... | <python><docker><edgedb> | 2024-05-13 08:15:59 | 0 | 2,914 | Michael Ushakov |
78,470,617 | 2,202,989 | pyModbusTCP packet buffer when no connection eats memory | <p>I have a working code that I use to send ModbusTCP commands to a device that can read them and perform actions. When network is fine, it works as expected. But if link is down, the packets are stored and buffered somewhere in either the pyModbusTCP or Linux (debian 9 based) buffers, and when the connection re-establ... | <python><linux><tcp><pymodbustcp> | 2024-05-13 07:18:16 | 0 | 383 | Nyxeria |
78,470,398 | 240,443 | basedpyright: a decorated function inside a function/method "is not accessed" | <p>(Not relevant to the question itself, but the example uses <code>quart-trio</code> package, which is similar in both interface and function to <code>flask</code>.)</p>
<p>This code has no errors:</p>
<pre><code>from quart_trio import QuartTrio
app = QuartTrio(__name__)
@app.route('/')
async def index() -> str:
... | <python><python-typing><pyright> | 2024-05-13 06:24:00 | 1 | 199,494 | Amadan |
78,470,258 | 1,581,090 | How to suppress an exception output in python code that is using pyshark? | <p>Running the following python 3.10.12 code on Ubuntu 22.04.4 using <code>pyshark</code> 0.6 seems to ignore the <code>try-except</code> statement of python:</p>
<pre><code>capture = pyshark.FileCapture(filename)
try:
for packet in capture:
pass
except:
print("exception")
</code></pre>
<p>Ev... | <python><python-3.x><exception><pyshark> | 2024-05-13 05:47:05 | 2 | 45,023 | Alex |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.