Category "python"

How to write variables in between single quotes in a textfile in python?

I have a bunch of strings to write in a text file. I want the strings to be written in simple quotes in the file, so I tried using this code: file.write("the va

Python canopen identify nodes

In the documentation I found a simple example how to scan the network for nodes, resulting in node_id values: network.scanner.search() # We may need to wait a s

SQLalchemy order_by hybrid_property resulting in "No such table"

My main goal is to make multiple filter options for a Car class. I can easily filter by distance and by the construction year, as they are just attributes of th

Seasonality is always 7 when running seasonal_decompose(). Why is that?

I have been running seasonal_decompose() from the statsmodels on about 20 totally different datasets. Is it standard that the seasonality is 7 when looking at a

I am getting this error "AttributeError: 'module' object has no attribute 'Completion'" when I try to use openai

this is my code and I get this error when I try to run it response = openai.Completion.create( AttributeError: 'module' object has no attribute 'Completion' imp

Flask static send from localhost to server

I am deploying an application on localhost and listening on a port on a remote server which is bound to a domain, the application shows up fine on localhost and

Socket error - return getattr(self._sock,name)(*args)

I have this error when I try to run this on my server can you help me error: line 228, in meth return getattr(self._sock,name)(*args) TypeError: listen(

the following arguments are required: -m/--model, -o/--output

I am attempting to run a GoogLeNet code, but then get this error: C:\Users\JG\AppData\Local\Programs\Python\Python39\python.exe C:/Users/JG/PycharmProjects/Goog

wkhtmltopdf-django dynamic template to render

Is there any way to generate a PDF dynamically, with content being fetched from the database? My goal is to allow my users to generate their own PDF design from

Tesseract doesn't recognize number

I'm deskewing an image containing a number using Projection profile based skew estimation algorithm and extracting it through OCR. In order to calculate the cor

Somehow an error is not being picked up by try... except

I am using a try... except loop to deal with opening a file that is updated throughout the day. Every now and then it would throw an error "pickle data is trunc

AWS: How to add tensorflow modules from EFS to Lambda function dependencies?

I'm trying to deploy my machine learning model to AWS Lambda function. I trained my model locally with Keras and got .h5 file. I zipped Tensorflow and Keras mod

Socket programming - Communication between server and client

I'm trying to learn about sockets and how to create a server and a client in python. While reading this great article from Real Python I had difficulties unders

Display text on point cloud vertex in pyrender/open3d

I am using SMPL demo code to display the SMPL-X mesh of a person. Instead of taking the default body joints, I need to select vertices corresponding to some oth

"ModuleNotFoundError: No module named 'rich'" even though I installed with pip

I'm trying to import the rich python module into my code, but I keep getting a 'ModuleNotFoundError' even thought I used pip install --user rich after getting t

How to resolve Key Error Exception when accessing dictionary key inside an if statement

I'm currently developing EV calculator using python and django. I get a key error exception when trying to access a dictionary key in an if statement inside a f

Using different instance of self as argument to method in python

I'm trying to create a method that takes self and another instance of the same method as its arguments, for example: class AClass(): def __init__(self

Iterate through pandas dataframe, select row by condition, when condition true, select a number of other rows, only containing unique values

I have a large (1M+) dataframe, something like Column A Column B Column C 0 'Aa' 'Ba' 14 1 'Ab' 'Bc' 24

How to scrape Trusted Shops?

I would appreciate your help on this scraping problem. I would like to scrape this site: https://www.trustedshops.de/bewertung/info_XDAD39B874C275A0751198C2510C

Iterate through pandas dataframe, select row by condition, when condition true, select a number of other rows, only containing unique values

I have a large (1M+) dataframe, something like Column A Column B Column C 0 'Aa' 'Ba' 14 1 'Ab' 'Bc' 24