Category "python"

Running Pythonscript over SSH from a Jenkinsagent doesn't start the script

Update: The problem seems to be quite different from what I initially thought. Information about this is at the bottom of the post. I've been having quite the s

cannot import name '_registerMatType' from 'cv2.cv2'

I got below error message when I run model_main_tf2.py on Object Detection API: Traceback (most recent call last): File "/content/models/research/object_detec

Python asyncio loop.run_forever()

I try to do a trading bot and the most things work fine. But everytime the internet connection is gone for a short time, the code fails. I use asyncio run_forev

Understanding pytest-django test arguments

What are 'rf' and 'user_context' parameters and when are they assigned? import pytest from rest_framework import status from rest_framework.reverse import rever

Iterate through a nested python dict

I have a JSON file that looks like this: { "returnCode": 200, "message": "OK", “people”: [ { “details: {

How can I read UploadFile in FastAPI?

I have a FastAPI endpoint that receives a file, uploads it to s3, and then processes it. Everything works fine except for the processing, that fails with this m

Setting X axis label name more frequently in Matplotlib

I have a dataframe like this Time(DDHHMM) True AOG Predicted AOG 5184 28:0:0.0 4.0 4.697324 5185 28:0:5.0 10.0 0.366948 518

How to write a simple code to do float calculation in Python?

I would like to write a code for this calculation: 3.3+4.8*6-4/2 Here is my code: from decimal import * a = Decimal('3.3') + Decimal('4.8') * 6 b = 4 / 2 c =

Make a dataframe avaliable until it's update [duplicate]

I have a Flask application with reads a dataframe and provide it in a service. The problem is that I need to update it (only a reading from s

Getting error 'NoneType' object has no attribute 'read' in python for image processing image_dataframe['image']

I am working on image classification using CNN. I am using below source code for that task. I am stuck with this error : AttributeError: 'NoneType' object has

Split dataframe column at specific words

One column in my dataframe is a long string. I want to split out portions of the string into its own column based on a few different words. What would be the be

How to reassign values in column by condition in dataframe?

df = pd.DataFrame([["A", "AA", "AAA", "found"], ["A", "AB", "ABA", "not found"], ["A", "AB", "ABB", "not found"],

Why is reqparse not understanding the POST request?

From what I've seen online, I can use reqparse from flask_restful to add data to my GET and POST requests. Here is what I have: from flask import Flask, request

How to write a simple code to do float calculation in Python?

I would like to write a code for this calculation: 3.3+4.8*6-4/2 Here is my code: from decimal import * a = Decimal('3.3') + Decimal('4.8') * 6 b = 4 / 2 c =

Make a dataframe avaliable until it's update [duplicate]

I have a Flask application with reads a dataframe and provide it in a service. The problem is that I need to update it (only a reading from s

Get data from XML using xml.etree - python

I was wondering if anyone could help me with a situation, I am trying to get some values from an xml request. But, I was not successful, if anyone has any idea

DRF how to update, create OneToOneField in serializers?

I have two models, with OnetoOne field. How can I update/create them with help of serializers? class Page(models.Model): info = models.TextField(null=True, bla

Image preprocessing code error of target detection neural network based on U-Net network architecture

Recently I found a U-Net-based target detection network code, but there is always a missing "image_index" in the definition position of the image preprocessing

How to add URL hyperlink to nodes created in network graphs with plotly?

I have successfully created a 3D network graph using Plotly and igraph in python using this helpful link. I want to manipulate those nodes meaning adding a hype

why this thread doesnt run parelally?

Hi I have the following code: def record_video(task_id): ( ffmpeg .input('a.mp4', t=t) .output(f'{task_id}.mp4') .run()