python-3.8

Upgrade python3.8 to 3.10 in Ubuntu Docker image

Upgrade python3.8 to 3.10 in Ubuntu Docker image Question: I am using playwright base image FROM mcr.microsoft.com/playwright Unfortunately, this comes with python3.8. I could either use python3.10 image and install playright on it, but it came with other complexities, so i chose to upgrade python on playright image to 3.10. So far, my Dockerfile looks …

Total answers: 4

How to add data from tk.Entry to f'string in Python 3?

How to add data from tk.Entry to f'string in Python 3? Question: I need to make a text generator in which user input is added to f’string. What I get in result is that data typed in entry can be printed in PyCharm console, but doesn’t show up in generated strings in tk.Text. Thank you …

Total answers: 1

How to plot uptime of an application using downtime and dates?

How to plot uptime of an application using downtime and dates? Question: In a CSV file, I have dates, downtime, and incident numbers of my application. Based on the below data I have to plot a graph of my application uptime using Python. Uptime for the last 7 days, Uptime for the last 30 days, …

Total answers: 2

How to update all but one python packages?

How to update all but one python packages? Question: I’ve multiple python packages installed on my system. My update script calls pip-review –local –auto to update all the python packages. However, I don’t want to update all packages. What I want is pip-review to update all packages except scons, since one of my programs needs …

Total answers: 2

How to avoid losing type hinting of decorated function

How to avoid losing type hinting of decorated function Question: I noticed that when wrapping a function or method that have some type hinting then the wrapped method loses the type hinting informations when I am coding using Visual studio code. For example with this code: from typing import Callable import functools def decorate(function: Callable): …

Total answers: 1

Calling the sklearn2pmml() function in Python 3.8 throws RuntimeError

Calling the sklearn2pmml() function in Python 3.8 throws RuntimeError Question: I’am trying to save my scikit learn logistic regression as pmml but get a RuntimeError: My code: from sklearn2pmml import sklearn2pmml from sklearn2pmml.pipeline import PMMLPipeline from sklearn.linear_model import LogisticRegression pipe_pmml = PMMLPipeline(steps=[(‘mapper’, mapper), (‘estimator’, LogisticRegression(C = 0.01, penalty = ‘l1’, solver = ‘liblinear’, random_state = …

Total answers: 2

How to produce the summary of dictionary values through Python?

How to produce the summary of dictionary values through Python? Question: I have the below sample dictionary, errors = [{‘PartitionKey’: ’34’, ‘RowKey’: ’14’, ‘Component’: ‘mamba’, ‘Environment’: ‘QA’, ‘Error’: ‘404 not found’, ‘Group’: ‘Test’, ‘Job’: ‘cutting’, ‘JobType’: ‘automated’}, {‘PartitionKey’: ’35’, ‘RowKey’: ’15’, ‘Component’: ‘mamba’, ‘Environment’: ‘QA’, ‘Error’: ‘404 not found’, ‘Group’: ‘Test’, ‘Job’: ‘cutting’, ‘JobType’: ‘automated’}, …

Total answers: 4

(Python) Why is my while loop not working?

(Python) Why is my while loop not working? Question: I have been working on an operating system inside of Python and I am starting off with the system booting code. I have a while loop that executes when the variable "Booting" = 1. Inside the while loop is a script that prints "Booting" then replaces …

Total answers: 1

asyncio: works in Python 3.10 but not in Python 3.8

asyncio: works in Python 3.10 but not in Python 3.8 Question: Consider the following code: import asyncio sem: asyncio.Semaphore = asyncio.Semaphore(2) async def async_run() -> None: async def async_task() -> None: async with sem: await asyncio.sleep(1) print(‘spam’) await asyncio.gather(*[async_task() for _ in range(3)]) asyncio.run(async_run()) Run with Python 3.10.6 (Fedora 35), it works just like in …

Total answers: 1

Sqlalchemy Error: sqlalchemy.exc.NoReferencedTableError

Sqlalchemy Error: sqlalchemy.exc.NoReferencedTableError Question: I need use sqlalchemy to create 4 table, student, subject, exam and score. Execept score, another can create. I was use argument back_populates and backref, but both can’t work. It show this error sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column ‘score.subject_id’ could not find table ‘subject’ with which to generate a foreign …

Total answers: 1