I need to loop through pdf with a lot of pages and split it into smaller pdfs if it meets a condition. The problem I’m having is clearing the pdf writer once it meets the condition. Here’s similar to what my code looks like from PyPDF2 import PdfFileReader, PdfFileWriter pdf_reader = PdfFileReader(open(‘giantpdf.pdf’, ‘rb’)) pdf_writer = ..

Read more

I tried to make this discord bot that plays music like a normal music bot,i used ffmpeg to download the song but when it needs to play it i get this error: Command raised an exception: TypeError: __init__() missing 1 required keyword-only argument: ‘args’,I don’t even know if it is an error to my code ..

Read more

I am pretty new to Django and I cannot figure out how to declare the value of a model. For example, if I have a CharField that takes the choice of three sizes s, m, l. Then auto-populate the value for length and width. So, it would be something like this. s = { "length": ..

Read more

I am getting the following error after running the training process for my network. RuntimeError: mat1 and mat2 shapes cannot be multiplied (21760×17 and 18496×512) This is the network architecture self.layer1 = nn.Sequential( nn.Conv2d(3, 16, kernel_size=3), nn.ReLU(), nn.MaxPool2d(2) ) self.layer2 = nn.Sequential( nn.Conv2d(16, 32, kernel_size=3), nn.ReLU(), nn.MaxPool2d(2) ) self.layer3 = nn.Sequential( nn.Conv2d(32, 64, kernel_size=3), nn.ReLU(), ..

Read more

@client.event async def on_raw_reaction_add(payload): message_id = payload.message_id if message_id == 855128466072272937: guild_id = payload.guild_id guild = discord.utils.find(lambda g: g.id == guild_id, client.guilds) if payload.emoji.name == ‘✅’: role = discord.utils.get(guild.roles, name=’Attending’) elif payload.emoji.name == ‘❌ ‘: role = discord.utils.get(guild.roles, name=’Not Attending’) else: pass if role is not None: member = payload.member if member is not None: ..

Read more

I’m scraping a website and I am trying to find ALL regex matches, currently I am just able to print out one of them (the first one), how would I go on about finding ALL of them? import requests import re headers = { ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0’ } ..

Read more

I am new at text mining, I am using Python. I have a list of lists, each list contains clusters of synonyms and each word in the cluster has a list which contains the number of sentences which it appears. The list i have is like this syn_cluster = [[[‘Jack’, [1]]], [[‘small’, [1, 2]], [‘modest’, ..

Read more