Category "python"

How to solve "RuntimeError: CUDA error: invalid device ordinal"?

I'm trying to run this code. I don't know what is wrong with it, but this code is not running. and I don't know how to solve this problem. import cv2 from facia

No BLAS/LAPACK libraries found when installing SciPy on macOS

I am using python 3.9.8 and pycharm on a macbook m1. I have already installed openblas with homebrew but I still get the error below. I tried installing SciPy v

Negative BIC values for GaussianMixture in scikit-learn (sklearn)

In scikit-learn, the GaussianMixture object has the method bic(X) that implements the Bayesian Information Criterion to choose the number of components that bet

Using a variable within str.contains()

Pretty much the title. Any way to use a variable to filter in str.contain()? i have been unsuccessful in using a str+@variable

Python Arrays sorting folder names

Hi could anyone explain to me how to sort the folder names in order of creation? list1=["New folder", "New folder 1", "New folder 10", "New folder 2"]

Decimal module in Python inaccurate

from decimal import * Pi=Decimal(3.141592653589793238462643383279502884197169399373) print(Pi) Actual output: 3.14159265358979311599796346854418516159057617187

Rotating a 2D image using change of coordinates and scipy interpolation

I'm trying to rotate my image but it is like my frame does not rotate at all. Here are the following steps of my code: 1 - Create an image of an inclined disk.

If sheet does not exist go to next Python

I'm writing a code that allows you to select the tables in a workbook sheet and send it by email. But it can happen that a sheet does not exist because there is

Python keyboard module non-functional with python 3.x and macOS?

So I'm trying to write a macro to automate a few tedious actions on my mac. I've been attempting to use the keyboard module for python (so that I can hook into

Storing Objects assigned to user while using Flask [duplicate]

I come here to ask you a question about the way session can handle Objects in Flask. I have a Flask application and I want all my users to hav

How to calculate average pixel intensity inside a laser line in Python?

I am trying to write a code that calculates the speckle contrast of a laser line. Here is an example of an image that I would be analyzing: The image is black w

Cannot debug pytest tests in Visual Studio 2022 -- symbols not loaded for my python code

I'm trying to debug pytest tests in Visual Studio 2022. I have the tests showing up in test explorer and when I run them they execute, however when I set a bre

Why I get forbidden error for only reading home timeline?

My code is as simple as this, but it gave me 403 error: def init_api(): api = json.load(open('secret.json'))['twitterapi'] consumer_key = api['api_token

Change position of a line with a specific string, using python

I am new to coding, trying to find a simple python code for re-arranging some lines. Lines have specific string to select. Those lines with this specific string

Python 3 RuntimeWarning: overflow encountered in double-scalars - trying to fit multiple gaussians and an offset using scipy.optimise.curve_fit

Hi all as with many peeps, I am new to python. Updated script that runs to completion but has a OptimizeWarning: Covariance of the parameters could not be estim

How to solve "error: Microsoft Visual C++ 14.0 or greater is required" when installing Python packages?

I'm trying to install a package on Python, but Python is throwing an error on installing packages. I'm getting an error every time I tried to install pip instal

Kraken API - Account balances request returning Invalid Nonce

so I am using the kraken api docs and I am trying to return my account balances but when running my python file I am getting {'error': ['EAPI:Invalid nonce']} r

PyGTK how to pass a Liststore row value to another class in another python file

In Glade, I created a Liststore that shows me a list of people. When I click on a line, then the line number is inserted into the self.radek_k_editaci variable

How to find the frequency of words in a list created from a .csv file

I am trying to write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of

Discord.py and Python Schedule, never awaited for?

I'm trying to send a message to a channel once a day at 02:39 using Schedule and Threading but I can't seem to get past asyncio "never awaited for". My code: @b