I’m trying to make a discord bot that would repost art submissions to the art channel after they are approved by the moderators. Every time I try to extract the attachment URL, I get this error: I tried searching this up on the Internet, but there is nothing. The only thing I found was this post, but I …
How to create .ts files for Qt Linguist with PySide6?
I have a python project written with PySide2 and now I want to migrate to PySide6. I used Qt Linguist to translate UI and created .ts files with help of this command: pylupdate5 utility from PyQt5 package (but it worked fine for my project with PySide2). Now I plan to get rid of PySide2 and PyQt5 packages. So…
How to split a string without using .split()?
I have a function that takes a parameter string and a ‘target’, where the target is a substring of the string. I need to output the index of these substrings within the string. I am not allowed to use the split function, so how else would I split up the string? Ex: if string is “we dont need…
How to put a text label next to a matplotlib.pyplot.arrow?
I can manually add a label next to an arrow in Matplotlib 3.4.3. by estimating its location. Output: I wonder if there is a builtin way to add the label to an arrow and align its label accordingly? if no what is the easiest approach? Answer Maybe a bit easier to read using axes.annotate but somewhat equivalen…
Cant load spacy en_core_web_trf
As the self guide says, I’ve installed it with (conda environment) I have spacy-transformers already installed. But when I simply do: It shows me this error: More info about the error: Answer Are you sure you did install spacy-transformers? After installing spacy? I am using pip: pip install spacy-trans…
Sum rows based on columns inside pandas dataframe
I am quite new to pandas, but I use python at a good level. I have a pandas dataframe which is organized as follows It is a fairly large dataframe (7 columns and ~600k rows). What I would like to do is: given a tuple containing values referring to the idbasin column (e.g. (1,2)), if the idrun value is the
Fire-and-forget upload to S3 from a Lambda function
I have a lambda function where, after computation is finished, some calls are made to store metadata on S3 and DynamoDB. The S3 upload step is the biggest bottleneck in the function, so I’m wondering if there is a way to “fire-and-forget” these calls so I don’t have do wait for them be…
Python Configparser. Whitespace causes AttributeError
I recieve some files with .ini file with them. I have to recieve file names from [FILES] section. Sometimes there is an extra witespace in another section of .ini-file which raises exception in ConfigParser module The example of “bad” ini-file: My code(Python 3.7): I can’t influence on files…
Django merge QuerySet while keeping the order
i’m trying to join together 2 QuerySets. Right now, I’m using the | operator, but doing it this way won’t function as an “append”. My current code is: I need the elements from querysetA to be before querysetB. Is it even possible to accomplish while keeping them just queries? Ans…
Trouble With SQL Query in Python
Hello I’m getting an error: near “join”: syntax error. Is there an obvious issue with this that I’m not picking up on? I’ve changed names in the query but I’ve gone over and checked for spelling errors already. Answer In SQL, the order of clauses is SELECT, FROM, JOIN, WHER…