Category "python"

Loading Captcha image form a site does not work

I am trying to collect Captcha images using the Python requests module and save them to file or load in memory for further processing, but nothing works as belo

how to keep asking user for right type of input if they type invalid input [duplicate]

This program calculates depreciation I want to keep asking user for input until it gives the valid input. def CalculateDep(amount,nofYears,rat

future got attached to different loop

Task <Task pending name='Task-11' coro=<Queue.get() running at C:\Users\Administrator\anaconda3\lib\asyncio\queues.py:166> cb=[_release_waiter(<Futu

How can I POST data in real time using FastAPI?

I built a simple demo project using FastAPI. I would like to POST data to the server in real time (maybe 30fps). # in client while True: .... res = requ

How to use shebang in windows for Python?

Code #! C:\Python310\python.exe import os import sys print(f"PY_PYTHON={os.getenv('PY_PYTHON')}") print(f"{sys.version=}") print(f"Shebang : '{open(__file__).re

Jupyter Notebook: Access to the file was denied

I'm trying to run a Jupyter notebook on Ubuntu 21.10. I've installed python, jupyter notebook, and all the various prerequisites. I added export PATH=$PATH:~/.l

Deleting a file from Google Cloud using fsspec

I am currently using fsspec in order to read and write files to my google cloud buckets with the code as shown below: with fs.open(gcs_file_tmp, "rb") as fp:

I have a dataframe with a json substring in 1 of the columns. i want to extract variables and make columns for them

imports json df = pd.read_json("C:/xampp/htdocs/PHP code/APItest.json", orient='records') print(df) I would like to create three columns extra: ['name','l

How to manage JSON data in javascript pass form django model?

I need to dynamically display my audio on my website. The audio is a file path stored in the Django model. Djanog Model: class audio(models.Model): instrumentId

Pyspark Py4JJavaError while creating the delta-table

Here is the pyspark code which is running on jupyter notebook. import pyspark from delta import * builder = pyspark.sql.SparkSession.builder.appName("MyApp") \

How can I record system audio from my speakers using Python?

I looking for script to record system audio, not microphone audio. I mean when I play music with a media player I want record it. I want record the sound output

How can I extract ISO and ASTM standards from a text using regex?

I would like to extract the ISO and ASTM standards from a text. The corresponding literals ISO and ASTM followed by the numbers would have to be found. Rules: M

unittest jsut runs 1 out of 4 test cases

We have this assigment where i should run these four test cases with the help of unittest but when I run it with the command python test.py (name of the file) i

How to fix "No module named 'nmap'"

import nmap ModuleNotFoundError: No module named 'nmap' the above is the result when trying to run the code after importing nmap. (I have installed python-nmap

Is there a Numpy equivalent of C++ std::vector reserve(), push_back() and shrink_to_fit()?

I would like to append elements to en empty Numpy array in-place. I know the maximum array size beforehand. I can't find a direct way to accomplish that, so her

SQLite python not returning false on an empty select

Hi having some issues with SQLite3 been having a good time with it up until now but recently ran into some issues when I was trying to check if a select stateme

just installed Python, getting WinError 32 for any libraries I try to install

I just installed Python 3.10 on my work machine. I went to pip install pandas and got a Win32 error on a temp file within the AppData Temp Folder.I have tried

Python websocket with FastAPI does not return data immediately

I created a websocket connection with FastAPI to "stream" data which comes from a tedious calculation. The data chunks should be send as soon as they are availa

how to "transpose" datas from a date to another one in python

Sorry i had a lot of trouble explaining my problem in the title but i hope it will be more understandable with this example : i have a data source that tells me

Python: 'ModuleNotFoundError' when trying to import file from same directory

Running Python 3.10. I have three files in the same directory named Chess, one of which is a __init __.py to make sure it's considered a module. In one file, Ch