I’m having some trouble debugging an issue, I have an asyncio project and I would like it to shutdown gracefully. When I run my code and send a KeyboardInterrupt or TERM signal from a different screen, nothing seems to happen and it doesn’t look like clean_loop is being called. EDIT: I think I was…
Tag: python
Strawberry+FastAPI: How to get request-info in a dependency?
Consider this code: How do I get the request info in the dependencies custom_context_dependency and has_root_access? Answer When I tried FastAPI’s Request, it was still showing some error when Strawberry’s page was opened. Later I understood that the error was being raised by WebSocket connection.…
NotImplementedError when calling pandas_profiling.ProfileReport.to_widgets() inside Apache Zeppelin
I’m trying to use the pandas_profiling package to automagically describe some data frames from inside Apaceh Zeppelin. The code I’m running is: My result is: Any way to work around this? Any hope of working around it from inside Zeppelin? Answer The NotImplementedError is being raised from check_d…
Highlighting the neighborhood of a node on selection
I created a graph using networkx and I am trying to plot it using bokeh. Currently, I am able to highlight the node that I clicked on, as well as the edges linked to the selected node. To reproduce the example, see the following code inspired from the official bokeh tutorial: I would like to be able to highli…
Python Process Pool with custom Process not able to respawn child processes
I have overridden multiprocess.Process (fork of multiprocessing library) like so: When I create normal Process using this class everything works perfectly, including creating logs. Now I want to create a Process Pool of such customized processes but I encountered problem with respawning such processes after t…
Poetry and buildkit mount=type=cache not working when building over airflow image
I have 2 examples of docker file and one is working and another is not. The main difference between the 2 is the base image. Simple python base image docker file: Airflow base image docker file: Before building the docker file run poetry lock in the same folder as the pyproject.toml file! pyproject.toml file:…
Eel – ask for directory input
I am developing modern-looking local app in Python with Eel and I want to open OS’s default dialog to select directory. But I have found that Eel does not provide that. I have tried: dialog from HTML/JS, but browser provides just dialog for file/s selection. local dialogs from other libraries, but they …
qtablewidget get new value after hitting “return”
i have a qtablewidget which is updated asynchronosly. now i am trying to set new values into the cells and read them back after hitting “enter/return”. i have a function that catches the keypressevent and try to read the actual value from the cell that was changed. the problem: i only get the prev…
Return random numbers from lists of varying size with weights
I would like to split existing data for a train-test-split in python. Functions like sklearn.train_test_split() typically choose evenly distributed values as testdata. But since I want to check, whether my model can deal with skewed data (more training data on “the left side of the function”) I ne…
Finding all the rows with the approximate values that match a condition in a dataframe
I have a panda’s dataframe that is something like this The el1, el2, and el3 do not matter at all. I want to find the row with the X nearest to x=20 so I do which gives me the index where x=19.3 is So far so good Now, the real problem Imagine I have a dataframe where x goes from