How to check the validity of the OpenAI key from python?
https://pypi.org/project/openai/"The library needs to be configured with your account's secret key whichis available on thewebsite. [...] Set it asthe OPENAI_API_KEY environment variable"When I ask...
View ArticleHow do I extract cvv from the discretionary numbers on a track 2 dump
How do I extract a cvv from the discretionary numbers on a track 2 dumpI got everything before the = sign and I got the first 7 numbers after the = sign but the discretionary numbers they are called...
View ArticleValueError: not enough values to unpack (expected 3, got 2) for...
I had an AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' error for uplaoding an image on Flask Admin. I corrected it to thumbnail_size = ((100, 100), PIL.Image.Resampling.LANCZOS)). Now...
View ArticleHow to find the next element using Python Selenium
how to check next available element using selenium pythonbrowser.find_elements(By.XPATH, "//*[@id='X7']") --- find the element but browser.find_elements(By.XPATH, "//*[@id='X9']") -- empty element
View Articlestring.replace replacing all occurences
I'm trying to make string.replace replace all words except ones starting with a certain character, e.g. ~, but if i have a word with only one letter, that letter gets deleted from the words i want to...
View ArticleHow to get business and technology only news from NewsApi in python?
I am trying to get a list of the top business/technology headlines using NewsApi in Python using this function:def get_customized_news(phrase, n_news=15,pageAmount=30): articles =...
View Articlejohnsnowlabs finance : module attribute error / S3 Access Denied
I'm trying to use the ESG model from johnsnowlabs according to thisI have the following code:import sparknlpfrom johnsnowlabs import nlp, financespark = sparknlp.start()sparknlp.version(),...
View ArticleIn nft scope ,how to use python translate the lower contract_address to the...
i want to follow the ECR-721 rule to standardize the display of all the contract_addresses that are made up with the low characteri d like to change 0xa66cc78067fd1e6aa3eec4ccdff88d81527f92c1 into...
View ArticleBuild a dynamic update query in psycopg2
I have to construct a dynamic update query for postgresql.Its dynamic, because beforehand I have to determine which columns to update.Given a sample table:create table foo (id int, a int, b int, c...
View ArticleHow to remove Jupyter + all its components completely (As if it never existed)
After I totally messed up my base (root) environment and the Jupyter installation within, I want to install it from scratch. To do so, I need to remove it entirely from my system. I tried the solutions...
View Articleregister=template.library() TypeError: 'module' object is not callable
I have writen a custom filter to show the number of products that has been added to cart page.here's custom filter cart_tags.pyfrom django import templatefrom order.models import...
View ArticleHow to customize output in API?
I am making a simple API using Python and Flask Framework and I am getting the correct output, but the problem with output is that It come in alphabetical order and I want to customize it in specific...
View ArticleGetting Error when trying to CREATE a converted Data frame to a CSV file
I'm trying to create a CSV file from a database. All the files are in the same directory. I have this code:import pandasdata =...
View ArticleCould not build wheels for dependency-injector, which is required to install...
I'm installing "dependency-injector" package for my project. But it keeps showing error like below(env) PS C:\Multi-Participants_Survey_Project-main-2\djangosurveybackend> pip install...
View ArticleHow to rotate+scale PDF pages around the center with pypdf?
I would like to rotate PDF pages around the center (other than just multiples of 90°) in a PDF document and optionally scale them to fit into the original page.Here on StackOverflow, I found a few...
View ArticleGo to Definition in Python Microsoft Extension is not working in modules
I have installedPython 2.7Visual Studio Code 1.471.Python Extension 2020.6.91350While Go to definitions works within same module, but if we import some other module, Go to definition don't workAny idea...
View ArticleIs it pythonic to use a shallow copy to update an object's attribute?
I found this code in the wild (simplified here), and I was wondering whether this is considered a good practice or not, that is, making a shallow copy (of an object's attribute in this case) for the...
View Articlecuda error while i run my code please help me as soon as possible
Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map...
View ArticleHow to match the font size of Kivy Spinner's Label with the font size of the...
I have created a UI using Python's Kivy with the following code.#-*- coding: utf-8 -*-from kivy.config import Configfrom kivy.uix.button import ButtonConfig.set('graphics', 'width',...
View ArticleHow to close a cv2 window within a Flet program?
The webcam window doesn't seem to close when any key is pressed including the "ESC" key?Here is an excerpt from the Flet app:cap = cv2.VideoCapture(0)def main(page : ft.Page): page.title = "fletCam"...
View Article