2,210,912 questions
0
votes
0
answers
11
views
Creating groups from dataset based on time intervals
I am working on expanding a script I have made to do some reporting for one of our projects. I need to determine length of video, location and a few other attributes. This part works well when there ...
0
votes
0
answers
9
views
How to get input from user for ad hoc manual runs
We have a small piece of code using snowpark using python to be run from inside snowflake. We need to get input from the user for ad hoc manual runs.
For example consider a code that takes start_date ...
-2
votes
1
answer
24
views
KeyError although it exists [closed]
I try to replace a couple of IDs in a description by new IDs. The mapping is done using a dictionary in Python.
import re
#Return a list containing every occurrence of "ai":
...
0
votes
0
answers
8
views
python.invalid command name ".!canvas"
I am making a ping pong game, in the line code ball movement(ball.goto(ball.xcor() +2, ball.ycor() +2) )
, after run the code it appear me this error message
Exception has occurred: TclError
invalid ...
0
votes
0
answers
8
views
How to run a Telegram bot polling asynchronously without blocking the main application (using python-telegram-bot version >= 20)?
I am trying to run a Telegram bot using the python-telegram-bot library (version >= 20) in asynchronous mode. The problem is that when I start the polling, the whole application blocks. I have ...
0
votes
0
answers
2
views
Linking GMenuModel to actions for context menus in Python Gtk3
I've built an application using Gtk3 and Gtk.Builder, using GMenuModel for the menus. So far so good. Now I'd like to add context (i.e. right-click) menus.
The menus themselves appear, but as I can't ...
2
votes
2
answers
23
views
How can I approximate 255/sqrt(x) using Newton's method?
I am trying to approximate 255 / sqrt(x) using Newton's method to avoid using division or the sqrt() operation on an architecture where those operations are expensive.
My derivation is:
y = 255 / sqrt(...
0
votes
0
answers
6
views
Creating an index in PyMilvus 2.5.x does not actually index any rows
I am trying to create an index on text embeddings for a RAG system with Milvus 2.5.x as vector database in Python. I have already create the collections and populated them. My dataset size is quite ...
0
votes
0
answers
5
views
ALSA problem using speech recognition on Debix model A
Card : Debix Model A
OS : Ubuntu 22.04
Hello I'm trying to work on a speech recognition script using Edgeimpulse on an Debix model A card running a Ubuntu 22.04 OS. When I try to run it I get theses ...
0
votes
0
answers
9
views
Deploying Keras model for prediction in Google Cloud Functions
I've been trying to deploy a very simple toy Keras model to Cloud Functions, which would predict the class of an image, but for reasons unknown, when the execution gets to the predict method, it gets ...
0
votes
0
answers
7
views
How to Set Dask Dashboard Address with SLURMRunner (Jobqueue) and Access It via SSH Port Forwarding?
I am trying to run a Dask Scheduler and Workers on a remote cluster using SLURMRunner from dask-jobqueue. I want to bind the Dask dashboard to 0.0.0.0 (so it’s accessible via port forwarding) and ...
0
votes
0
answers
10
views
Is there a way to read an .egp file without using SAS Entreprise Guide?
I want to scan using Python a folder containing hundreds of .sas and .egp files.
The .sas files are not a problem since I can simply read them like that :
with open(file_path, 'r', encoding='latin-1') ...
0
votes
0
answers
13
views
Wheel File Not Including templates Directory and Root Files in Python Package
Background:
I am new to using Python packaging tools and have typically relied on custom tooling. However, I’ve decided to get a better understanding of the packaging process, but I’m running into an ...
0
votes
1
answer
20
views
Calculate the distance on a document from point to point in relative units
I have a template pdf file (although for solving this problem it is absolutely not important, the file can be like an image). The file size is
dimensions = (5725, 4015), where dimensions[0] - axis x, ...
0
votes
0
answers
7
views
Simulating mouse clicking in html treemap generated from python Ploty
I am trying to create a treemap that shows orders, families, genera, etc etc. The treemap works perfectly, I used the Ploty package from python, the data I imported are in a csv file and the resulting ...
0
votes
1
answer
14
views
Managing Token Limits in GPT-4o for Variable-Length Input and Output
I’m using GPT-4o via the Azure OpenAI API to handle variable-length queries, but I frequently encounter token exhaustion when the combined token count of my input and output exceeds the model's ...
1
vote
1
answer
19
views
Why does scipy.sparse_matrix not accept values directly from a dataframe?
I create a scipy sparse matrix that works fine
X = csr_matrix(
(df["rating"], (item_idx, user_idx)),
shape=(M, N)
)
But to simplify where (roughly equivalent)
item_idx ~= df[...
0
votes
0
answers
7
views
Adding Edge Color to the Network Graph using Networkx package
PATY_HI
PATY_LO
MATCH_KEY
WEIGHT_BUCKET
12345
6789
T
r
54321
3456
A;T
b
34567
12345
EP;T
y
I'm using the Networkx package to create a visualisation of the associations of a customer, so the user ...
0
votes
0
answers
6
views
Error: pg_config executable not found in a dockerfile [duplicate]
I'm getting an issue with psycopg2 when I build the image on Debian machine.
I have a dockerfile:
FROM python:3.12-slim
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
ENTRYPOINT [ "...
0
votes
1
answer
13
views
Having a hard time dealing with cron-job.org API
I want to create a cron job on cron-job.org through their API using python.
As a result, I get 404.
I don't know exactly what is not found
from datetime import datetime
import requests, json
# Cron-...
0
votes
0
answers
16
views
Python CosmosDB upsert_item deletes document
I am going to update a document using upsert_item function of CosmosDB Python SDK.
Here is a script:
from dotenv import load_dotenv
from azure.cosmos import CosmosClient
import os
import uuid
def ...
1
vote
1
answer
16
views
How to correctly identify entity types for tokens using spaCy using python?
I'm using spaCy to extract and identify entity types (like ORG, GPE, DATE, etc.) from a text description. However, I am noticing some incorrect results, and I'm unsure how to fix this.
Here is the ...
-1
votes
0
answers
10
views
How to loop datasource in UI.Vision
I created a functioning script that opens a page, selects options 1 and 2 from a.csv file, and submits; it then loops and repeats the process. Everything has been wonderful up to this point. Just one ...
-1
votes
0
answers
17
views
Chat with Sql: I want to show query result table in the form of dataframe in my web app and also make chart
The code generates a SQL query, executes it, and stores the result in a variable named result. I want to display this result as a data frame, including the column names from the original query. I am ...
0
votes
0
answers
8
views
mock motor AsyncIOMotorClient with uuid settings
I have AsyncIOMotorClient code as below.
def get_client():
"""
Get Client.
Get the client for the database connection.
"""
return motor.motor_asyncio....
0
votes
0
answers
17
views
Why is my Azure Functions deploy not working through GitLab CI/CD despite working when done with Azure Function Core Tools extension in VSCode?
I've created some Azure Functions using Python (3.9) and I'm having trouble setting up the CI/CD in the GitLab repository where the code resides. This repository resides in an Azure VM, not sure if ...
-1
votes
0
answers
9
views
Avoid Turning Image Black When Removing Background Conditionally Using OpenCV
Problem Description:
I am working on a Python script to remove the background from images using OpenCV. The goal is to:
Check if background removal is needed (for images with simple or uniform ...
-1
votes
0
answers
22
views
Discriminated union over instance attributes
Suppose I have the following class
class MyClass:
def __init__(self, ...):
self.attr1: Union[Attr11, Attr12]
self.attr2: Literal["val1", "val2", "val3"...
0
votes
1
answer
22
views
How does ConvTranspose in pytorch with groups > 1 work?
I'm trying to underestand the workflow of convtranspose of pytorch with groups > 1 , mainly focusing on the calculation process between grouped transposeconv weights and padded input, I've ...
0
votes
1
answer
6
views
Python Kivy & Buildozer : How remove the Kivy logo and message "loading ..."
I've built a little application that works just as well on PC as it does on Android (nothing complicated; the application is excessively simple).
Everything works fine on my android and on my debian ...
1
vote
0
answers
20
views
Changes detected after squashmigrations
python manage.py showmigrations shows:
mainapp
[X] 0001_initial
...
[X] 0240_employer_data
[X] 0241_person_metadata
[X] 0242_personemployer_employerworkplace
[X] ...
-3
votes
0
answers
24
views
How do you import libraries so you can use coloured text while using an online IDE with Python?
I am using an online IDE: www.online-ide.com or replit.com make a text based dungeon game. I am trying to use coloured text to make things clearer with the combat system but cannot work out how to. I ...
0
votes
1
answer
17
views
Pytest fails with "ValueError: Missing staticfiles manifest entry for 'assets/img/favicon.ico' " while STATICFILES_STORAGE is set to default in tests [duplicate]
FAILED tests/test_views.py::test_index_view - ValueError: Missing staticfiles manifest entry for 'assets/img/favicon.ico'
In my Django Template based project I have the error above when running ...
0
votes
1
answer
16
views
How to handle ever-changing password in psycopg2?
Similar to how to handle ever-changing password in sqlalchemy+psycopg2? I an faced with a PostgreSQL setup where passwords are rotated frequently. My application runs longer than a password is valid ...
2
votes
2
answers
34
views
Compute percentage of positive rows in a group_by polars DataFrame
I need to compute the percentage of positive values in the value column grouped by the group column.
import polars as pl
df = pl.DataFrame(
{
"group": ["A", "A&...
1
vote
1
answer
16
views
Vectorize objects in python Jax
I am unsure what is the best way to vectorize objects in Python Jax.
In particular, I want to write a code that handles both calling a method from a single instantiation of a class and from multiple (...
0
votes
0
answers
8
views
Wrong padding tokens in HF model prediction
Please consider the following code:
from datasets import load_dataset_builder, load_dataset
import numpy as np
import os
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, ...
3
votes
0
answers
10
views
ImportError: libgridstore.so.0 when importing GridDB in Python3.10
I'm trying to get GridDB working on my WSL/Ubuntu environment. I have followed https://pypi.org/project/griddb-python/ to install griddb and was successful but when trying to import the module I'm ...
0
votes
1
answer
19
views
python selenium chrome close window
trying to login instagram from chrome but its instantly closes the window here is the code
url = "https://www.instagram.com"
from selenium import webdriver
from selenium.webdriver.common.by ...
0
votes
2
answers
28
views
Could not find a version that satisfies the requirement contourpy==1.3.1
I'm conda to manage a python project, now I want to deploy my app to a linux machine.
ihave this Dockerfile :
FROM python:3.9-slim
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
...
0
votes
0
answers
7
views
Dynamic Allocation or Declaration of Robot Framework Variables
I have a script that automatically generates Robot Framework testcases based on a few parameters. Now in this generated testcases there might a ssh connection or some other things that has predefined ...
-4
votes
0
answers
27
views
How do extract text from PDFs including all the spaces [closed]
I'm being trying to create some code to extract text from PDFs and putting them into a database, I've been using extract_text() for this.
However, for some reason some of the spaces between words are ...
0
votes
0
answers
14
views
Not able to create a repo using template repo GIthub API
I have generated a personal access token and configured Single Sign-On (SSO), providing full authorization to the token. The issue I'm facing is that while I can successfully create GitHub ...
-3
votes
0
answers
22
views
Phython Code for BOT returning incorrect result [closed]
This Bot should be working this way simply but I can't locate where things went wrong. TBH, I am not a developer but a beginner learner.
A user opens the chat and sends the bot a link this link has a ...
0
votes
0
answers
9
views
VIsual Studio does not accept launch.json (pydebug)
I want to debug my python project using a remote debugger. So I created this launch.json file in .vscode folder of my project.
{
"version": "0.2.0",
"configurations&...
0
votes
0
answers
8
views
Issue with Mamba Transformer Implementation for Medical Image Detection
I am currently working on a medical image detection problem on the Kaggle platform and attempting to use the Mamba transformer for this task. However, when I ran the code below, I encountered an issue ...
0
votes
0
answers
16
views
Is egg-info still the recommended way to manage python packages installed in editable mode?
I am installing local python package in editable mode, using a pyproject.toml file to configure it. The pyproject.toml looks like this:
[build-system]
requires = ["setuptools", "...
0
votes
0
answers
13
views
python polars in jupyter lab leads to error due to infer_schema_legth
I often run into data fetching errors when I'm working in JupyterLab and trying to use polars instead of pandas as the dataframe library.
I do this by running the statement
%config SqlMagic.autopolars ...
0
votes
0
answers
12
views
ERPNext v15 Dahua time attendance Employee CheckIn integration
I am trying to push employee attendance data with this code:
import local_config as config
import datetime
import requests
import json
def _safe_get_error_str(response):
"""
...
-1
votes
0
answers
37
views
How do I replace text in a word document table using information from an excel file?
I have a template where I am trying to replace certain text with information from excel. The problem is that once I have replaced and saved the file, the conditions I have set no longer apply and all ...