Quantcast
Browsing all 14069 articles
Browse latest View live

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 Article


ERROR: 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 Article


Image may be NSFW.
Clik here to view.

Send 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 Article

No 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 Article

Can 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 Article


Converting 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 Article

Possible 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 Article

Data 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 Article


Plotly: 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 Article


JSON 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 Article

Why 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 Article

Dynamically 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 Article

How 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 Article


polars: 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 Article

Add 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 Article


Using 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 Article

Error 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 Article


Why 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 Article

How 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 Article

Cell 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
Browsing all 14069 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>