Python Unittest for method returning json string
I ma new to writing python unit tests. I have a method in a class returning a Json response from an API. The JSON response contains attributes such as data, token, object name and status. The method...
View ArticleERROR: Failed building wheel for src Running setup.py clean for src Failed to...
win 11 , py 8 / 10 / 11/ 12.2 // pip 24i try install pip install src and get error pls see the errorr` AttributeError: 'NoneType' object has no attribute 'has_pure_modules'[end of output]note: This...
View ArticleSend GSD Command in JSON to Zebra Printer
Trying to send commands (not labels) to Zebra printers using Python.On page 574 of the documentation it shows:Here's my code:mysocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) host=...
View ArticleNo module named 'matplotlib.typing'
I am receiving an error message: ModuleNotFoundError: No module named 'matplotlib.typing' with this bit of code:from plotnine import *(ggplot(the, aes(x='Trial', y='Weights', colour='Cues')) +...
View ArticleCan anyone tell me what is wrong here?
So I'm working on a college project with my group and we decided to make a QR code generator with some faciltites here and there. The problem is that the HTML part was made by someone else and I'm...
View ArticleConverting array of Integers to String in Python
Can someone please help me with below request.I am trying to convert the below output from sql in Python and use as stringValue=[(132,), (2434,), (233434,), (56644,), (3435,),...
View ArticlePossible to change Bios,SystemEnclosure,BaseBoard,Cpu in powershell through...
I have problem is there way to change Bios,SystemEnclosure,BaseBoard,Cpu serial number programmatically in powershell or python? If yes could someone show me command for that?Change serial number...
View ArticleData Reconcilition with Python, outof memory error
I want to reconcile by reading data from two different databases. I get an out of memory error while reading the data for a job that will run on a single machine.I read the data with pandas by taking...
View ArticlePlotly: Share x-axis for subset of subplots
The following python code will share the x-axis for all three subplots:from plotly.subplots import make_subplotsimport plotly.graph_objects as gofig = make_subplots(rows=3, cols=1, shared_xaxes=True,...
View ArticleJSON causing multiple of the same key in a python dictionary for my Discord...
I am coding a multipurpose Discord bot, but all my commands all terminate when the server they run in is not in my dict data. This is great, but it terminates even when the server is in that dict.When...
View ArticleWhy is this throwing: "TypeError: '_io.TextIOWrapper' object is not...
def getnamesofstaff(file): names_of_staff = [] print("file =",file) for lines in file: line = lines.strip().split(",") name = line[0] if name in names_of_staff: breakpoint else:...
View ArticleDynamically adjusting index in a function
I have the following problem. I have this code. The whole code can be found here.from gurobipy import *import gurobipy as guimport pandas as pd# Create DF out of SetsI_list = [1, 2, 3]T_list = [1, 2,...
View ArticleHow to construct an array of unique objects?
Within my code I need to create an array of a user specified magnitude, usually the code I'd use for this is:array = [[x] * a for b in range(size)]In the above examples the variables are as follows:x...
View Articlepolars: add a constant to an existing column
Dataframe:rng = np.random.default_rng(42)df = pl.DataFrame( {"nrs": [1, 2, 3, None, 5],"names": ["foo", "ham", "spam", "egg", None],"random": rng.random(5),"A": [True, True, False, False, False],...
View ArticleAdd more than one custom order to a bag session - Django e-commerce application
I am building a Django e-commerce application. I have implemented to ability to leave a custom order on the site and for users to be able to update the quantity, delete the custom order and checkout. I...
View ArticleUsing Python requests module to collect data tables from drop-down list from...
I am trying to scrape information from this webpage-https://www.dmr.nd.gov/oilgas/bakkenwells.aspI want to collect all data tables from dropdown menu and use Beautiful Soup and requests module to pull...
View ArticleError while multplying decimal numbers in pyhton
I am working on a project for a job opportunity and it was asked to handle disease facts.I was running the code and the calculations worked just fine in Python and at some point, the results started...
View ArticleWhy does the output image not resemble polygon art despite in the provided...
Certainly! Here's the text written in the first person:I've been experimenting with creating polygon art using a custom script in Python. The script I'm using incorporates algorithms to generate...
View ArticleHow do I use the functions within this Python script?
I have this Python script to control a PfSense router via FauxAPI. The problem is that when i call a function it gives an error. I think i'm calling the function wrong. Does anyone know how to call...
View ArticleCell in snake game grid always going to the top of the screen
In my computer science class, I am assigned to code a mod for a basic snake game program. I decided to add a feature where when the user presses the SPACE bar, it will shoot out a portal depending on...
View Article