I am using the clean architecture & TDD development method in my Python project. Updating from SQLAlchemy 1.3 to SQLAlchemy 1.4 broke the ability to test against an in-memory Postgres DB, and I can’t find how to fix the problem. Following DDD principles, the project uses the new imperative mapping syntax …
Kivy Python: confused with class and instance methods
I was trying kivy and while I was accessing class variables, I was forced to use ‘self’ for class variables or else it was producing error. This is the kivy code I was using. Below is the main.py code where I have confusion: This code works. Here I am using class variables and accessing them from …
How do I shuffle the words that are connected to a key in a dictionary?
I have a dictionary I want to shuffle the values in this dictionary to different keys. I tried splitting the dictionary into two like this… And shuffling the values with But I keep getting a type error:’dict_values’ object is not subscriptable I want to recreate the dictionary but with shuff…
How can I condense this Python Tkinter GUI input code?
I’m taking part in Code in Place 2021 and for my final project I developed a Madlibs generator using Python and Tkinter, and the code is functional and works the way I want it to, but obviously it’s pretty long and convoluted. I was hoping some of you guys could offer some suggestions on how to ma…
comparing multiple columns in dataframe (more than 2)
I have a data frame my code requirement all the ranks must be different then 1 else 0 but I am getting b also as 1 Answer We can filter the rank like columns, then use nunique along axis=1 to check for the occurrence of N unique values
AttributeError: ‘dict’ object has no attribute ‘data’
An error occurred while executing the KNN algorithm. I don’t know where the error occurred. Can anyone help me? Please. There is a code below. I don’t know why, but the code was cut. Answer One line defines: That’s a dict comprehension statement In the next loop you have It’s that use …
While working with selenium, an error showed which was saying that ‘import “selenium” couldn’t be resolved.’
I dont’ find a problem in my code and it is showing another problem which is – : driver = webdriver.Chrome(excutable_path=’C:Program Fileschromedriver.exe’) TypeError: init() got an unexpected keyword argument ‘excutable_path’ Answer You are using excutable_path instead of …
Flask static file importing issues
I’m trying to write my first webapp with Flask. I learned that to use css in my site, I have to use a static folder, because my css is never gonna change while the site is running (when it is online). So i created it, wrote a bit of css, imported it in my html via this portion of code
Convert yolov4-tiny to transflow lite: ValueError: cannot reshape array of size 374698 into shape (256,256,3,3)
As I try to covert my yolov4-tiny custom weight to tftile, it always happen. This is what I input: And the wrong message appear. I have checked my labels.txt and there is no space or more lines.Also, I have changed the name in config.py. Is there any way to solve this problem? Thanks for help! Attach part of …
How to go back a character in a string in Python
What I’m trying to figure out is how to go back a position in a string. Say I have a word and I’m checking every letter, but once I get to a “Y” I need to check if the character before was a vowel or not. (I’m a beginner in this language so I’m trying to practice some stuff…