Category "python"

IndexError: list index out of range with api

all_currencies = currency_api('latest', 'currencies') # {'eur': 'Euro', 'usd': 'United States dollar', ...} all_currencies.pop('brl') qtd_moedas = len(all_curr

IndexError: list index out of range with api

all_currencies = currency_api('latest', 'currencies') # {'eur': 'Euro', 'usd': 'United States dollar', ...} all_currencies.pop('brl') qtd_moedas = len(all_curr

Return does not return information

When wanting to return a value with the return and wanting to use it later in a variable, nothing is returned to me. #Actualizacion de informacion def messageHa

How to create a loop/function to open set of shapefiles?

How can I create a loop or a function to open many shapefiles at the same time where the names of the shapefiles change very little? For example with the data b

Is there a way to make sure formatted string is always in quotations?

I am working on a new tool to help automate some tedious processes. it involves ExchangeOnlineManagement, Python, and Powershell. I have input variables that I

How to use multiple databases in Django with an empty 'default'?

I'm trying to make a multiple database project in Django. But I'm having problems to properly migrate my models to the appropriate database. I'm using the 'Writ

It doesn't pick up the variable correctly in subprocess.call (python)

I am creating a telegram bot to send the information that I request to the app. When I run the code below it works fine except for the last part, when it does t

Error in .exe of python script having Barcode from Reportlab.graphics

I have a python script for generating barcodes (code128) which works fine in IDE. But when converted into exe, it encounters below error: Traceback (most recent

How to get all checked items in SelectMultipleField in WTForms + Flask

I have a SelectMultipleField but when I try to access checked items, thought form.fields.data I only get the first of them. More over, by trying to get answers

Why is are my rows not being written to the CSV file?

With the code below the CSV file aaab.csv is created but nothing is written to it. The print(row) gives me the correct information. What am I doing wrong? I hav

Date and time conversion using Pandas & Python to create Ts

I'm trying to get Ts using my existing data of data and time, which looks like (Pdb) df[0][:7] 0 [Data & Time] 1 Jan 01 08:00:01.193 2 Jan 01 08

cv2 SystemError when using webcam on MacOS

I am trying to run a very simple script using opencv, which should display frames from my webcam (on a 2019 macbook pro running OS Catalina) until interrupted.

Python error - Traceback (most recent call last)

I entered this code. I entered the example alike in the book where I could study Python. from turtle import Screen, Turtle import random screen=Screen() image1

How to create a timed input in python with a correct answer?

How would I create a program which asks the user for an input but if they dont respond with an answer within 5 seconds tells them that the time is up. But if th

What's the best practice for Python multiprocessing to write to a shared dictionary?

I have millions of NumPy arrays that I wish to process, ultimately generating a collective histogram plotting the frequencies of seen integers. I wish to utiliz

Bad Request | CSRF Token Not Found | CSRF Handling for Flask WTF

The Issue I work for a couple of simple volunteering organizations helping with management and running campaigns, but we needed a system to track peoples hours

What is the right way to measure server/client latency (TCP & UDP)

I am sending and recieving packets between two boards (a Jeston and a Pi). I tried using TCP then UDP, theoritically UDP is faster but I want to verify this wit

How can I detect image artifacts?

I need to make the script that will return True if image contains visual artifacts that look like gray clusters of pixels Kind of artifact that I want to catch

pandas - how to access the value of next 16 rows as a list of 16 numbers

Say I have just 2 columns in pandas. Column 1 has all numerical values and column 2 has values only at the every 16th position (so column 2 has value at index 0

How to search by dict keys in ElasticSearch

I am new in elasticsearch and I need to write query described below I have an elasticsearch index with documents like this one Numbers mean entries of words in