Categories
Linux Mastering Development

Cant Run this Python File. Can you help?

I am using Kali Linux 2019 , Trying to install this Source : https://github.com/ptrkrysik/multi-rtl I have installed everything required, but what dose this, here, mean here? I run ./mutlirtl_rx_to_cfile_2chan.py as root, and get this error message. Traceback (most recent call last): File "./mutlirtl_rx_to_cfile_2chan.py", line 17, in <module> import multi_rtl File "/usr/local/lib/python2.7/dist-packages/multi_rtl/__init__.py", line 30, in <module> […]

Categories
Mastering Development

os.rename does not succeed in renaming in subdirectories, throws FileNotFoundError despite using glob.glob with recursive=True

The following code is meant to rename files named "notes" to "notes.html.pmd" in the cwd and in sub-directories. Those still on Python3.7 and earlier versions need to get rid off the walrus operator and substitute fileListOld = glob.glob(f"{(cwd := os.getcwd())}/**/{old_name}", recursive=True) with cwd = os.getcwd() fileListOld = glob.glob(f"{cwd}/**/{old_name}", recursive=True) in order to run this code. […]

Categories
Mastering Development

Learning Python – TypeError: ‘NoneType’ object is not subscriptable

I am trying my best to learn Python as I recently switched my major and have become infatuated with the world of Computer Science! I genuinely enjoy it however there are times where like a lot of people do get stuck. I am currently doing a Udemy course and trying to tackle one of the […]

Categories
Mastering Development

Issues with Ansible Tower

We are getting below error while running playbook from Ansible tower with control machine below playbook working fine. Error with Ansible Tower:- TASK [Retrieve facts from device running Junos OS] ***************************** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module ‘enum’ has no attribute ‘IntFlag’ fatal: […]

Categories
Mastering Development

xclip and xsel – FileNotFoundError: [Errno 2]

I have kivy 1.10.1, python 3.8.2 and I code on Ubuntu20.04. When I launch my little program, I receive this error: [CRITICAL] [Cutbuffer ] Unable to find any valuable Cutbuffer provider. xclip – FileNotFoundError: [Errno 2] Aucun fichier ou dossier de ce type: ‘xclip’ File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 55, in core_select_lib mod = __import__(name='{2}.{0}.{1}’.format( File "/usr/lib/python3/dist-packages/kivy/core/clipboard/clipboard_xclip.py", […]

Categories
Mastering Development

“Unique constrainted failed” problem when running migrations

I have been tryed to change a django model by applying and running migrations but I have been getting this error django.db.utils.IntegrityError: UNIQUE constraint failed: new__startup_home_mates.user_id How can this error be fixed? I have already investigated a lot but I have found nothing that fits my situation. I have already tried to use RenameField and […]

Categories
Mastering Development

Error when defining a custom probability distribution (stack overflow?) (Python)

I defined the following custom probability distribution: import scipy.stats as st # parameters a = 3 / 16 b = 1 class linear_fractional(st.rv_discrete): def _pdf(self, n): if (n == 0): return (a + b – 1) / (a + b) else: return (a * b ** (n – 1)) / (a + b) ** (n […]

Categories
Linux Mastering Development Ubuntu

TypeError: cannot use a string pattern on a bytes-like object [closed]

I am doing HackTheBox Web Challenge & I have to write a Python Script in order to solve it. I am writing a python script to fetch the HTML code of the website & remove the unnecessary HTML tags. This is the script: import requests import hashlib import re req = requests.session() url = "http://docker.hackthebox.eu:30596/" […]

Categories
Mastering Development

scrapy python typeerror positional argument

This is my first scrapy project, and the purpose is to scrape this page “http://books.toscrape.com/”. The page contains a several link for books. The idea is to scrape the title of the books. Here is the code: import scrapy class SpiderSpider(scrapy.Spider): name = ‘spider’ allowed_domains = [‘http://books.toscrape.com/’] start_urls = [‘http://http://books.toscrape.com//’] def parse(self, response): all_books = […]

Categories
Mastering Development

Python ValueError: not enough values to unpack (expected 3, got 2)

I am getting python for, Code _, threshold = cv2.threshold(gray_roi, 3, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) contours = sorted(contours, key=lambda x: cv2.contourArea(x), reverse=True) Error (2nd line) Traceback (most recent call last): File “/Users/hissain/PycharmProjects/hello/hello.py”, line 17, in <module> _, contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) ValueError: not enough values to unpack (expected […]