Categories
Mastering Development

ValueError Cannot query “customer1@gmail.com”: Must be “Customer” instance

I am trying to save the customer to the Order Model, but the customer is not being saved, it shows customer1@gmail.com must be Customer instance. And also I want to save the seller to the Order model. Because, A product is related to a seller. When I order something, and after the order is saved, […]

Categories
Mastering Development

want to start ninja-ide but won’t start

install ninja-ide in my kali Linux, whenever I run this code “ninja-ide” to run it this error keeps on coming….. Traceback (most recent call last): File “/usr/bin/ninja-ide”, line 34, in <module> ninja_ide.setup_and_run() File “/usr/share/ninja-ide/ninja_ide/__init__.py”, line 71, in setup_and_run core.run_ninja() File “/usr/share/ninja-ide/ninja_ide/core/core.py”, line 48, in run_ninja from ninja_ide.gui import ide File “/usr/share/ninja-ide/ninja_ide/gui/ide.py”, line 45, in <module> […]

Categories
Mastering Development

Unable to pass arguments in python3 class

Firstly, I created a class that has __init__() on it in models.py, as you can see below. And when I import it in my views.py, the vscode intellisense also shows that my class takes 4 arguments. But when I try to run the program, it shows me an error saying that the class doesn’t take […]

Categories
Linux Mastering Development Ubuntu

Why is pip unable to install packages?

I’m trying to install this list of packages: tensorflow-gpu umap-learn visdom webrtcvad librosa>=0.5.1 matplotlib>=2.0.2 numpy>=1.14.0 scipy>=1.0.0 tqdm sounddevice Unidecode inflect PyQt5 multiprocess numba However, I get this error when running the command to install them: pip install -r requirements.txt Defaulting to user installation because normal site-packages is not writeable Collecting tensorflow-gpu Using cached tensorflow_gpu-2.2.0rc2-cp38-cp38-manylinux2010_x86_64.whl (516.3 […]

Categories
Linux Mastering Development

Bluetooth keeps changing from A2dp to headset and loses connection on Debian Buster with JBL 4 Speaker

since over a year I am having trouble with the bluetooth connection to my JBL 4 speaker. It looses connection again and again. I created a script according to what I found on the internet to reconnect via keyboard short cut. Sometimes it is connected with it within a view seconds sometimes I had to […]

Categories
Mastering Development

How to use Tuple/Array/Vector to call PARI/GP from Python (ctypes)?

I would like to call PARI/GP from Python. I need to use ellisdivisible(E; P; n;{&Q}) function of PARI (see function no 3.15.35 on page 441 in this link:), so I have to pass 2 vectors or arrays (e.g, E = ellinit([0,-1,1,0,0], K);P = [0,0];), how I do that? To call a PARI function(in C) of […]

Categories
Mastering Development

How to compare one picture to all data test in siamese neural network?

I’ve been build siamese neural network using pytorch. But I’ve just test it by inserting 2 pictures and calculate the similarity score, where 0 says that picture is different and 1 says picture is same. model = Siamese() # Load state_dict model.load_state_dict(torch.load(‘model/model-batch-101.pth’)) # Create the preprocessing transformation here from torchvision import transforms transforms = transforms.ToTensor() […]

Categories
Development

Django, Materialize, Django-tables2: Expected table or queryset, not str

I have a form and one of the fields is a MultipleChoiceField. The form is rendered in a modal using Materialize. I had issues to render the choices in the form but found this answer I changed the field to: comp = forms.MultipleChoiceField(choices=COMP, widget=forms.Select(choices=COMP, attrs={‘class’: ‘browser-default’})) which solved the rendering issue. Once I submit the […]

Categories
Development Linux Ubuntu

Lutris broke, 1 week down the rabbit hole, pip refuses to run

My lutris install broke, and after a week down that rabbithole of errors, i have been halted. lutris spits out this error message Traceback (most recent call last): File “/usr/bin/lutris”, line 34, in <module> from lutris.gui.application import Application File “/usr/lib/python3/dist-packages/lutris/gui/application.py”, line 34, in <module> from lutris.game import Game File “/usr/lib/python3/dist-packages/lutris/game.py”, line 11, in <module> from […]

Categories
Development

Trying to parse Word Documents and getting PdfReadError: EOF marker not found

I am testing some Python code to loop through resumes, open each, parse each, and create a comprehensive report based on the contents of each resume. Here is the code that I am running. #importing all required libraries import PyPDF2 import os from os import listdir from os.path import isfile, join from io import StringIO […]