Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 13921 articles
Browse latest View live
↧

Travelling Salesman in Python PDDL

I use pddl python framework to implement the travelling salesman problem. This framwork translates from python language to pddl language and then the language is executed with fast-downward. I have...

View Article


low level of logging in python does not work

I am trying to do logging in python.# class CustomFormatter is to change timezoneclass CustomFormatter(logging.Formatter): def converter(self, timestamp): dt = datetime.fromtimestamp(timestamp,...

View Article


how to iterate through the dataset from hugging face?

I have a dataset saved in a local drive, and i can load and convert this dataset to json or csv format and saved it to my local drive. I want to know , if there is a way i can stream this data and...

View Article

Pygame problem user_input appear always in the next iteration

In fact, I am a new software student who jsut finished his python class. I am learning myself how to work with pygame. In fact, I am trying to implement a math game which proposes random math equations...

View Article

Difference between BINARY_ADD and INPLACE_ADD

I was going through the dis package of python. I tried code to see how it is working >>> def get():... x=4... y=x+3 ............ this line... z=8... return yand then run dis.dis(get) which...

View Article


Is it possible to override __getitem__ at instance level in Python?

With the following code :import typesclass Foo(): def __getitem__(self, x): return xdef new_get(self, x): return x + 1x = Foo()x.__getitem__ = types.MethodType(new_get, x)x.__getitem__(42) will return...

View Article

Keep getting Crawled 0 pages (at 0 pages/min)

I am new to scrapy so I am following this tutorial https://www.youtube.com/watch?v=mBoX_JCKZTEand it uses this websighthttps://books.toscrape.comI am calling apon my code by doing scrapy crawl "name of...

View Article

Image may be NSFW.
Clik here to view.

NameError: name 'html' is not defined

i do not undeeeerstand why this error appears and what cab i do to solve it. it s is my first time scraping uxing this mdthod so be cool (^^) pls. i thou it was the good methode, but...thx for ur...

View Article


Python unittests: how to get an AsyncMock to block until a certain point

I have some async Python code I want to test, which include something likeasync def task(self): while True: await self.thing.change() ... self.run_callbacks()In my test file, I'm starting the task in...

View Article


How to fix ArgumentError: List argument must consist only of tuples or...

This is my method:def print_relative_strength_by_ticker(self, tickers): # print relative strength tickers_list = tickers.split(" ") if len(tickers_list) == 1: query = "SELECT ticker, rs FROM...

View Article

How to control the connection pool size in Flask-SQLAlchemy?

Link: https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/In Flask-SQLAlchemy 2.4 onwards the SQLALCHEMY_POOL_SIZE setting is deprecated.What is default pool size?Where can I control this value?...

View Article

Image may be NSFW.
Clik here to view.

Python Selenium Faliure SyntaxWarning: invalid escape sequence '\C'...

I am trying to run my first automation of Python Selenium on PyCharm Community Edition:from selenium import webdriverdriver =...

View Article

How to: Loop over a list/dictionary of SqlAlchemy Instances and insert or skip

Good Evening All,I set out to do what I thought was a simple task. I want to create a seed that can be run multiple times and will only insert new values if they aren't found in the db already. Using...

View Article


Inverting a dictionary in Python with lists as values [duplicate]

I'm a little new to python and programming in general. I'm having some difficulty inverting a dictionary in the way that I want. I have a dicitonary that is a has three names as keys and they each have...

View Article

"Service Unavailable" new trying to deploy Cloud Run Flask App

This is the repository for the flask application I have built:https://github.com/Guido1Alessandro1Trevisan/repMomentIt works perfectly well in local host however when I try to deploy it using google...

View Article


Can i write a python script to unzip a bunch of files into their own...

I got a bunch of vst and their all zipped. I mean like a lot of them. Like lots. I do not wanna go unzip them individually. Help pleaseI wanna write a script maybe with the zipfile library and the os...

View Article

Integrating OAuth2 Login for Swagger API with firebase auth

class AuthenticationMiddleware(BaseHTTPMiddleware):"""Middleware to authenticate requests using Firebase Auth.""" async def dispatch(self, request: Request, call_next: Callable): # This is where you...

View Article


Image may be NSFW.
Clik here to view.

Reduce the number of classes in yoloR

in YoloR algorithm, in yolor_csp.cfg and yolor_csp_x.cfg, I want to change the number of classes from 80 to 1 because I have only 1 classes and filters from 255 to 18, but after changing there is error...

View Article

Compare a date column to a specific date [closed]

I have a date column in a table in excel which i have read into a pandas data frame; i want to compare the dates with last date of few months and basis that assign a month year value in another column....

View Article

Can't stop seleniumwire defaulting to https

I'm trying to use seleniumwire with the chrome webdriver to automate a task that is tedious and it seems like it's redirecting from my input of http://somesite.com:port/ to https://somesite.com:port/....

View Article
Browsing all 13921 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>