Category "python"

Selenium cant find an element unless the page is inspected

I am automating with selenium and noticed something weird, on a specific webpage, there is a ul list containing some li roles that are buttons. For some reason,

PyOpenGL texture isn't displaying correctly

I was trying to put texture onto quad with this code: import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * from PIL import

np.histogram outputs?? - Python

Trying to understand what kind of output do I get from the histogram function. phase = mod(phase,Nper*2*pi) cl_phase = arange(0,Nper*2*pi+step,step) c,p = histo

Value error trying to fit a logistic regression with SentenceTransformer output (embeddig)

My code: model = SentenceTransformer('hiiamsid/sentence_similarity_spanish_es') I apply the model to the text column of the data frame prueba['encoder'] = prueb

Invalid classes inferred from unique values of `y`. Expected: [0 1 2 3 4 5], got [1 2 3 4 5 6]

I've trained dataset using XGB Classifier, but I got this error in local. It worked on Colab and also my friends don't have any problem with same code. I don't

How to write a custom FastAPI middleware class

I have read FastAPI's documentation about middlewares (specifically, the middleware tutorial, the CORS middleware section and the advanced middleware guide), bu

Pylance Intellisense not working as expected with Django

I'm trying to understand how to configure Pylance to make it work correctly in my Django project. Below is one of many examples where Pylance is not able to fin

how to add data to database in django

I send the data I get from websocket with javascript to the view.py section of python-django with var xhr = new XMLHttpRequest() ///. my question is; The data c

On Python, How to open multiple command windows simultaneously (in cascade)

I intend to monitor connectivity (by ping ) 3 devices into the net. So far I tried the follow scripts but in some, the commands run in a single windows import

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