Category "python"

MyPy checking typing.Protocol with Python 3.7 Support

I have a project which needs to support Python 3.7, but I would like to use typing.Protocol, which was added in 3.8. To support 3.7, I have a minor bit of fallb

RuntimeError: main thread is not in main loop when tkinter GUI is closed

I'm trying to create a tkinter GUI that presents the 10 processes that are taking up the cpu, refreshing it every 2 seconds, similar to top, on the linux comman

How to tell to tox use trusted host and index?

I use the following usage for pip3 to install modules from my host: pip3 install tox -i http://myhost/sample+ --trusted-host I downloaded a bog code.It uses t

Django forms.Form reflecting property field constraints

I'm implementing a Django Form witch should contain the field 'fieldA' from modelA: class ModelA(models.Model): fieldA = models.CharField(max_length=8)

Converting PYODBC output into an int

Pulling data from a SQL query that gives me 1 number that is stored in a PYODBC row. I want to then add that number to another variable in the file. Pseudocode

Live stream output from JS MediaRecorder to Python speech recognition server via soket.io

I'm trying to stream microphone from my browser to a server running a Python service connected to the google cloud speech-to-text. For the transfer I'm using so

Python & Selenium: How to get Elements in DevTools with CDP (Chrome DevTools Protocol)

I'd like to get all source code in Elements with Chrome DevTools. Although I tried the following code, these values are not match with the above code. body = d

how to exit this loop in python

why does break doesn't work? I want the code to stop when I click the specific key import keyboard def loop(): x = 1 while True: print(x)

Select all in pandas where column equals value and all other columns are blank

I have a DataFrame containing permissions for roles of each user, e.g. function/role role1_permissions role2_permissions role3_permissions role4_permissions ca

Pandas : How to apply a function with multiple column inputs and where condition

I have a pandas dataframe. I want to generate a new variable (column) based on multiple column inputs where the year index is greater than a certain value. The

Where to pass the lock object? what is ws, msg?

I'm trying to use yliveticker library to connect to yahoo finance websocket and simultaneously log data into df using a different thread. I dont understand what

Assigning technicians to tasks with limited transport available between tasks

I am using Google OR-Tools to solve a problem where technicians work on tasks to fix machines. The machines are all initially broken and the objective is to fi

Python sqlite3.OperationalError: no such table:

I am trying to store data about pupils at a school. I've done a few tables before, such as one for passwords and Teachers which I will later bring together in o

Copy cells full and append to other page

I have a google sheet connect to a google form. The form is compiled by team leaders with his members and some informations that are reported in a row by google

Python continue function wont start the code all over again

I am trying to start the whole code again but it restarts the current loop can someone help? while guessp1 & guessp2 != answer: if guessp1 == answer

Import Error: cannot import name 'BatchNormalization' from 'keras.layers.normalization'

I am getting the following error message when trying to run this AlexNET python code. Traceback (most recent call last): File "C:\Users\PycharmProjects\Local-

find files with similar ID from different folder

I have two folder A and B. in each folder I have text files containing participant IDs starting from 100. some files can be present in both folders. i want to c

how to create a employee multiple Experince in django

How to Create Multiple Experinces in Django This is Model.py Files code from django.db import models # Create your models here. class Detail(models.Model):

how to read a csv file edited from excel in python?

Hi I tried loading the csv file that has been edited and saved as csv comma delimited. However it's not loading right. I used the normal pd_read_csv like so. df

Add the same value in multiple cells when parsing data to a spreadsheet with openpyxl

Can I add the same value in two cells at the same line of code I want to put "Run No." in the cell ["A1"] and ["B1"]. I could do this sheet["A1"] = "Run No." s