Quantcast
Browsing all 13921 articles
Browse latest View live

How to send SMS via Python using SMPPLIB? or other smpp libs?

Could you help with sms sending via smpp directly to SMPP server(SMSC). I need python code.ChatGpt generated below code, can you evaluate the correctnessfrom smpplib.client import Clientfrom smpplib.sm...

View Article


Is string a valid type for annotation Sequence[Sequence[str]]?

This is a typical example of a value that can be annotated by Sequence[Sequence[str]]:[ ['This', 'is', 'the', 'first', 'tokenized', 'sentence', '.'], ['And', 'this', 'is', 'the', 'second', 'one',...

View Article


How to pack two buttons of the same kind?

I'm working on a simple contact list application, and I want that Tkinter places a button for every contact made.This is the code I've made:from tkinter import *main = Tk()main.title("Contacts...

View Article

boto3 only uploads 1KB of a large video from stream

I run the following code in a microservice deployed in a Kubernetes cluster. I run a ffmpeg subprocess and pipe the output into a upload_fileobj. When I run this with a 20MB video, it completes without...

View Article

How can we assign global weights to the data instead of being algorithm (ML...

I am using pycaret and scikit learn for ML and i want to apply weights to features globally such that they can work with any algorithmI tried using class_weight parameters in the models but i want to...

View Article


"UNKNOWN" project name and version number for my own pip-package

I successfully built my first Python-Package using a pyproject.toml with setuptools. I am able to install it and use it in Python, however I wonder the name of the project is "UNKNOWN" and the version...

View Article

Any way to remove the git repository using python

In my project I have used the python-git module to clone the repo.but for the cleanup I have to remove the directory as well.I am using the following method for cleanup but it did not work.def...

View Article

How to create seperate time.sleeps in python?

I'm new to pythonimport timeimport randomdaily = ("/daily")ten = ("/ten")hourly = ("/hourly")while hourly == "/hourly": print("TYPE_HOURLY") time.sleep(3605)while ten == "/ten": print("TYPE_TEN")...

View Article


Hugging Face Instruct Embeddings not woking

I am fresher in the prompt engineering. Suddenly, I am facing a problem in the HuggingFaceInstructEmbeddings. I am using langchain and GoogleGenerativeAI in vscode. My python version 3.10.0 and...

View Article


pyfork send_photo trouble [400 FILE_REFERENCE_EXPIRED]

Using pyrogram and trying to send photo from getting telegram story from my channel I have following error:pyrogram.errors.exceptions.bad_request_400.FileReferenceExpired: Telegram says: [400...

View Article

merge some columns in a pandas dataframe and duplicate the others

I have a similar problem to how to select all columns from a list in a polars dataframe, but slightly different:import polars as plimport numpy as npimport stringrng = np.random.default_rng(42)nr =...

View Article

partially initialized module 'keras.src' has no attribute 'utils' (most...

AttributeError: partially initialized module 'keras.src' has no attribute 'utils' (most likely due to a circular import)this are my import filesfrom flask import Flask, render_template, request,...

View Article

How to check if column of NumPy array contains specific string?

Let's assume I have an NumPy array:contacts = np.array([ ["Apples","Burger"], ["Bananas","Cake"], ["Grapes","Honey"]])Now, I want to find at which position "Banana" is and clear the entire column, so...

View Article


AttributeError: module 'tensorflow.python.types.trace' has no attribute...

tensorflow version 2.14.0 ---->it is the only one which is compatible for my programfirst i faced problems with kensalazyloader, tensorflow.tsl and now thislast few lines of the error: File...

View Article

Telebot Error: ChatBoost Missing Arguments in Infinity Polling - Group Limit...

My Python telebot was working great for a few weeks, but today, this error started to occur:(__init__.py:1021 MainThread) ERROR - TeleBot: "Infinity polling exception: ChatBoost.__init__() missing 3...

View Article


Scrapy spider skips pages and stops before end

I'm developing a spider with scrapy and Playwright to scrape a retail brand website. Basically, it's parsing all images of all colors of all products on all pages (page -> product -> color ->...

View Article

Optimize binomial distribution for large numbers without using modules

I made this code to simulate the odds of getting tails "m" times when you toss a coin "n" times:def factorial(n): if n<0: return "Indefinido" if n==0 or n==1: return 1 else: valor=1 for i in...

View Article


extract single element from a list and insert it into another list

I have a list formed like this['s3://dx-datalake-modl-svil-3075-bucket-layer/DX/WDOS/VV_SALDI_TITOLO/c_acr=GE/c_giorno_t=20201231/',...

View Article

Failed building wheel for uwsgi

I got an error,Failed building wheel for uwsgi.My environment is Ubuntu,now I wanna install uwsgi,so I run command pip install uwsgi.But error happens Traceback (most recent call last): File...

View Article

How to remove nested for loops while filling a matrix

I am trying to fill a larger matrix (A) by using the entries of a smaller matrix (B), the relevant python code isdim = N_Om * 2 * aA = np.zeros(dim * dim, dtype="complex").reshape(dim, dim) # Large...

View Article
Browsing all 13921 articles
Browse latest View live