Category "python"

Why do I get AttributeError: 'NoneType' object has no attribute 'something'?

I keep getting an error that says AttributeError: 'NoneType' object has no attribute 'something' The code I have is too long to post here. What general scena

Discord bot is still offline

To launch my discord bot, I followed the way using Heroku but... In Heroku, main.py is on, but my discord bot still offline. I tried to change main.py with the

Python-docx: convert type <class 'docx.oxml.text.run.CT_R'> to <class 'docx.text.run.Run'> to apply a highlight

I have a function using python-docx which outputs a CT_R object. I'd like to be able to convert it to a Run object such that I can then apply a styling change,

Discord Python Bot, auto-unban after given time, how do I save the time until a user gets unbanned even if the bot goes offline?

I'm making a discord bot in python, and want to add a temporary ban command. The only problem is that if the bot goes offline (power outage, altering code, ect.

Google colab: Read .xlsx file in from Github pandas

from Google Colab, I am trying to create a df from a xlsx file I have on a Github repo. As url I take the permalink from Github, the repo is public and account

Python tuple to dict - ValueError: too many values to unpack

Here's the tuple I'm trying to convert to a dict: rule_tuple = tuple((('rule1', 'col1', 'val1'), ('rule1', 'col2', 'val2'), ('rule1', 'col3', 'val3'), ('rule2',

Rotating an object using the angle between its header and click

So I'm building a robot/car in a graphic interface and I was able to make him move to wherever I click. Now I would like it to face the point it is going to mov

How to satisfy output line length, code line length and Black code formatting at the same time? I.e. textwrap.wrap drop whitespace before wrapping?

This might be an XY-problem regarding the question about textwrap.wrap. I don't need to use textwrap.wrap if there's an easier way. I want to satisfy the follow

How do I make two seperate stopwatches controlled by two different stop and start buttons in tkinter gui. My computer wont let me

I am trying to make a timesheet where every employee times in in the morning and times out at the end of the day. It is going well so far but, I the Why is the

Is it possible to enforce via CI that module_a does not import anything from module_b?

I'm maintaining several open source projects and I want to write code at work that nudges people to do the right thing. I have a situation where I see people im

Clear CAPTCHA Success From HTML

I'm trying to scrape some site data and have cleared the CAPTCHA I'm triggering manually - however I continue to load the CAPTCHA success page after I close and

How to convert list of images to batchxheightxwidthxchannel format shape?

I have a list of images each with shape=(20, 20, 1), there are 10 images so len(list)=10. How can I convert this into tensor/array with shape=(10,20,20,1)? Than

Why is not the following 3D polar plot of Array Factor being plotted?

import numpy as np import math as mt import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as axes3d #############################################

How to plot some datasets in pandas based on different thresholds in python

I have a data frame that has 3 columns and I want to plot a line graph based on some thresholds. Here is the data frame date income ratio 0 2022-0

Classify DataFrame rows based on first matching condition

I have a pandas DataFrame, each column represents a quarter, the most recent quarters are placed to the right, not all the information gets at the same time, so

AsyncIO coroutines with different IP's

I am building a python bot to check thousands of url json adresses and gather the information I need in these jsons. My problem at the moment is the speed, main

unable to install pywebview

I try to install pywebview but it just gives me a long error: ERROR: Command errored out with exit status 1: in general, I'm trying to find a way to wrap a webs

Creating classes dynamically in python [duplicate]

Is it a good coding practice to have the class name as variable. E.g def create_class(class_name): class class_name: def __init__(self

how to open passward protected excel file and save in dataframe

i know this question has been asked many times , i have read through the answers of previously asked question however im still not getting how to open the file

litstudy Package Installation Python

I am Trying to do Co-Citation Network analysis and have to install package called "litstudy" in Python but I am getting an Error installing it in Jupyter and Py