Skip to content

Tag: python

discord bot sends infinite messages regardless of user input

I’m trying to make a discord bot respond when someone makes laughing remarks but it infinitely sends gifs whenever someone types anything code is as follows Answer In addition to some formatting, I changed some of the variables for the API calls. I commented out the keep_alive.py as I assume you are usi…

Convert a list of Vector to a matrix with petsc4py

I have a list of vectors that I want to gather in a single matrix Z. Here is the code I tried to use : I tried setValues and setValuesBlocked. When I run this script on one core, that works well. The result printed is : but in parallel I have issues : I think it’s because PetSc waits for

Finding specifig value in class – Selenium (Python)

I’m trying to scrap a website using selenium. I tried using XPATH, but the problem is that the rows on the website change over time… How can I scrap the website, so that it gives me the output ‘21,73’ ? Answer You can just use querySelector that accepts CSS selectors. I personally like…

Why can’t I install a Python package with the Python requirement “>=3.8,<3.11" into a Poetry project with the Python version "^3.9"?

I’m having an issue installing dependencies into my Poetry project. If I run poetry new (as described in https://python-poetry.org/docs/basic-usage/), I can create a new project: My project structure looks like this after I delete a few files not needed for this reproduction: My pyproject.toml file look…