Category "python"

python gzip.open: zlib.error: Error -3 while decompressing data: too many length or distance symbols

I want to decompress a huge gz file (wikidata json dump latest-all.json.gz , 104GB compressed) on the fly in python with gzip.open. It works fine for a while. H

ngrok tcp address cant connect to my python chat app (python3)

Q: "ngrok tcp address cant connect to my python chat app (python3)" Description: i got a problem with linking my ngrok tcp address into my python chat app and i

How to initialize a Pydantic object from field values given by position instead of name?

I am not able to find a simple way how to initialize a Pydantic object from field values given by position (for example in a list instead of a dictionary) so I

Solve linear Inequalities

I want to solve a system of inequalities A x <= b, namely to visualize the set of solutions of this system. Are there any ways to do this in Python? The solu

pandas, creating dataframes based on tuple

I have a tuple that has data for several categories. Now I want to extract small dataframes from this tuple for each category based on a list I created. I want

JsException(TypeError: Failed to fetch)

When I try to import a pyscript source code to my HTML it shows a "JsException(TypeError: Failed to fetch)" error. helloworld.py print("Hello World") testPyscri

How to plot correlation matrix/heatmap with categorical and numerical variables

I have 4 variables of which 2 variables are nominal (dtype=object) and 2 are numeric(dtypes=int and float). df.head(1) OUT: OS_type|Week_day|clicks|avg_app_s

How to handle keep alive received probe on python server

In a python-written server with TCP socket defined as follows: def create_tcp_socket(bind_address): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

How to connect broken lines into one continuous line?

I have this picture: As you can see, some lines are not connected. These lines were drawn using semantic segmentation. What I want is to connect these lines, b

Given a Cerberus JSON Schema file, how can I generate a dictionary object

Problem I have a Cerberus Json schema file and I need to generate Json files based on the schemas with default values given the data_types. The key _type in th

Sum of different slices rows and column

I have pandas DataFrame df and three arrays columns_list, lower_boarder and upper_boarder all have the same shape. I want to find array with shape as input arra

pyvirtualdisplay - downloads are stuck as .part file

I have a python-selenium script running on a debian 11 server without any Desktop - thats why i use pyvirtualdisplay. The script has to login to a website and t

Getting average score from a text file in python?

I'm looking to have the program read a text file that is formatted like this for example. Kristen 100 Maria 75 Frank 23 Is there anyway in python to skip lines

Have subprocess.Popen only wait on its child process to return, but not any grandchildren

I have a python script that does this: p = subprocess.Popen(pythonscript.py, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=False) theStdin=request.input.encode('

Selenium python : my current_url doesnt update after click

Im scraping a website where I need to retrieve values from the url when i click on a button providing different form values. I have a problem: when i click the

ValueError: There may be at most 1 To headers in a message

I am trying to write a very basic email sending script. Here is my code .. import smtplib from email.message import EmailMessage msg = EmailMessage() msg.set_c

Utilizing the Websocket Data from Android cellphone while running

Using SensorServer, I am establishing a connection between an android phone and Python and utilizing the data sent. The accelerometer of the Android device is u

How to store contents of string array into 2D array in python and perform operations without any built in function?

I have tried almost everything I cannot figure it out. I cannot figure out which array to use. This is the question and the required output:

Standard answers for a speech in a AI

I am building a project where there is a software, It should answer to questions as "Hi","What your name?", "How are you?", ecc. Is there a standard answers I c

How do I use an API key/secret on Binance's TestNet?

Following the instructions here, https://docs.binance.org/smart-chain/wallet/arkane.html, I created a Binance SmartChain account with its "0x" prefixed wallet a