Issues with FastAPI Uvicorn workers

I have a sample FastAPI application, with a single endpoint which returns the result a after a delay of 5 seconds. Please find the code below. from fastapi import FastAPI import uvicorn, os app = FastAPI() @app.get("/delayed-response")

Continue reading →

My Flappy Bird running on Python dies before even reaching the first pipe

I am beginner in python and i am doing a mini project for a school assignment. we are required to make the flappy bird game using python. with numerous references, i concluded that this particular one: https://github.com/maxontech/flappy

Continue reading →

ModuleNotFoundError: No module named 'flags.state'; 'flags' is not a package

I've succesfully installed the flags package: pip install flags

Continue reading →

How to check Python environment for hidden modules (not listed, but can be imported)

To expand on the title, my question comes in two parts: Is it possible for a Python package to be installed in an environment as a dependency for another package, but not show up when you list down all installed packages in that environ

Continue reading →

Tensorflow model won't train. Help me find the answer

I have this code: https://pastebin.com/ijHx7y2Q . The code should train a model using mfcc coef to recognize a speaker. As this is my first project where i play with "AI", i used the dataset (with some additions) and the code from this t

Continue reading →

Django cors headers doesn't work with django channels

I have a project in django and when I added django channels my cors stopped working correctly # settings.py ... ... ... DEBUG = True ALLOWED_HOSTS = ['localhost'] CORS_ALLOWED_ORIGINS = [ "http://localhost:3000", ] CSRF_TRUSTED_

Continue reading →

Savung Tfrs Model

Hello so i am trying to train a model using tfrs, so i have successfully trained the model the problem is saving the model but i keep getting the error WARNING:tensorflow:Model's `__init__()` arguments contain non-serializable objects.

Continue reading →

Python and regex, can't understand why some words are left out of the match

s = ("If I’m not in a hurry, then I should stay. " + "On the other hand, if I leave, then I can sleep.") re.findall(r'[Ii]f (.*), then', s) The output is: I’m not in a hurry, then I should stay. On the other hand, if I leave The qu

Continue reading →

Qml table and chart using python

Halo guys, how i can make a table and chart using qml and python as backend for read csv file and live chart the values in table, anyone help, i m using qt creator for make a application for my project... Thank you Complete Qml and pytho

Continue reading →

How can I install python packages in a virtual environment?

I am trying to use virtualenv. I used this command to install the package: pip install virtualenv Then I create a folder using this command: python -m venv venv Now I want to use django package in this environment. What should should do?

Continue reading →

How to run mitmproxy in Heroku?

I am using mitmproxy with Python. Python version is 3.11.0 and mitmproxy version is 10.2.0. When I install mitmproxy, it installed other dependencies such as mitmproxy-macos==0.5.1 mitmproxy_rs==0.5.1 urwid-mitmproxy==2.1.2.1 When I run

Continue reading →

Converting a List of Dictionaries to Pandas Dataframe

I have this code: import urllib.request, json url = "https://api.wto.org/timeseries/v1/indicator_categories?lang=1" hdr ={ # Request headers 'Cache-Control': 'no-cache', 'Ocp-Apim-Subscription-Key': '21cda66d75fc4010b8b4d889

Continue reading →

About New Feature

I just wish you to suggest a feature called "Print All Files Of Directory" like PyCharm. Its one of the best feature of PyCharm to print the codes written in several files of a directory in a PDF. This feature will help various students

Continue reading →

Convert .xlsl to .json using JavaScript or Python

i have a table in the format --------Header-------- Name Subject Hours v1 v2 v3 v4 v5 v6 i want the json file to have this format: { { "Name": "v1", "Subject": "v2", "Hours": "v3" }, { "Name": "v4", "Subject": "v5", "

Continue reading →

How do you add annotation to an element inside a Table Cell

I'm new to using Python and currently using borb pdf package to create pdf documents. I am trying to build a table of contents page with page numbers that links to the designated page. Here is what my current code looks like: doc

Continue reading →

Pydantic models not hidden in FastAPI OpenAPI documentation

I'm working on a FastAPI application where I'm trying to hide certain Pydantic models from appearing in the OpenAPI documentation generated by FastAPI. I've followed the documentation and set the "include_in_schema" attribute to False wi

Continue reading →

Encoding issue with requests getting json

I want to get topography for French departments with this code : import pandas as pd import requests link_dep = 'https://code.highcharts.com/mapdata/countries/fr/fr-all-all.topo.json' topo = requests.get(link_dep).json() x = topo['objec

Continue reading →

How to take the previous value and next value of the current loop?

I'm doing a heat index calculation project that will take the temperature and humidity values from files Temperature365.txt and Humidity365.txt , But if it found a value 0, I want it to take the previous value and next value to find the

Continue reading →

How to print set of increasing values for a specific number of repeats for a user defined function

I am trying to get this bit of code to print a set of coordinates that increase by a set number and print the whole set of them, but so far I can only get the first set of coordinates to print. I am very new to python and I'm pretty sure

Continue reading →

Python parse XML file using minidom

I need to return the value from the email address element where the is WORK. I do not want the HOME email address type. [email protected]

Continue reading →