Skip to main content

Posts

Sonoma Python 3.8 was manually installed yet system shows 3.9.6

I have a mac running on Sonoma OS. I know it comes with python automatically, but I need a version 3.8 or less for some projects Im working on for school. However, I have installed 3.8 using homebrew which was installed, but the version of python didnt change. I've tried to update it using pyenv and I haven't been able to update the version. The crazy thing is that even though the version is stated as 3.9.6, if I look for it, I can't find it. Here is what I did so far: $ brew update $ brew install python@3.8 $ python3 --version Python 3.9.6 $ which python3 /usr/bin/python3 $ which python3.8 /usr/local/bin/python3 $ which python3.9 python3.9 not found $ brew install pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile echo 'eval "$(pyenv init -)"' >> ~/.bash_profile source ~/.bash_profile Restart your shell so the path chan

how can i fix this script for deleting bad words in chats

words_to_filter = ["badword1", "badword2", "badword3"] @bot.event async def on_message(message): print(f"on_message event triggered") # Add this line if message.author == bot.user: return for word in words_to_filter: if word in message.content: print(f"Bad word found: {word}") # check on_message event await message.delete() #message delete await message.channel.send(f"{message.author.mention}, Õ¤Õ¸Ö‚Ö„ Ö…Õ£Õ¿Õ¡Õ£Õ¸Ö€Õ®Õ¥Õ¬ Õ¥Ö„ Õ¡Ö€Õ£Õ¥Õ¬Õ¾Õ¡Õ® Õ¢Õ¡Õ¼ Õ±Õ¥Ö€ Õ°Õ¡Õ²Ö€Õ¸Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¸Ö‚Õ´") # after deleting message send message return else: print('Falseee') # if script not working print 'Falseee' return await bot.process_commands(message) terminal output: I tried several options to check if all events are working the function of the code is to remove bad words in the message after running the code, when I send any word in the

Line 22:6: React Hook useEffect has a missing dependency: 'auth.token'. Either include it or remove the dependency array

Error webpackHotDevClient.js:115 ./src/components/Layout/Routes/private.js Line 22:6: React Hook useEffect has a missing dependency: 'auth.token'. Either include it or remove the dependency array Line 22:7: React Hook useEffect has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked react-hooks/exhaustive-deps Private.js import { useState, useEffect } from "react"; import { useAuth } from "../../../context/auth"; import React from "react"; import { Outlet } from "react-router-dom"; import axios from "axios"; import Spinner from "../../spinner"; export default function PrivateRoute() { const [ok, setOk] = useState(false); const [auth] = useAuth(); useEffect(() => { const authCheck = async () => { const res = await axios.get("/api/v1/auth/user-auth"); if (res.data.ok) { setOk(true); } else {

Make GPT (Store) instructions output exact JavaScript code pattern answer [closed]

I have created a GPT app in the store, that outputs JavaScript Web Components. Since GPT is trained on old Web Components GPT is biased in its output. For example, because older blogs and even MDN say "use super() first in the constructor" , GPT outputs: constructor() { super(); const createElement = (tag, props = {}) => Object.assign(document.createElement(tag), props); let shadow = this.attachShadow({ mode: 'open' }); shadow.append( createElement( "style", innerHTML = `` )); } But uou can use JavaScript before super() because it sets and returns the this scope. I want it to write: constructor() { const createElement = (tag, props = {}) => Object.assign(document.createElement(tag), props); super() .attachShadow({ mode: 'open' }) .append( createElement( "style", innerHTML = `` )); } These are my instructions (related to this part of the code): * Include a `createElement(tag, props={})=>Object.assig

How to replace a xml tag in a word document using python-docx and BS4

I am trying to remove all the text from a word document and leave just the images. I tried doing for p in document.paragraphs: p.text = '' but that removes everything so then i set a condition like: for p in document.paragraphs: if len(p.text)>0: p.text = '' it worked but did not save the images within paragraphs that included text, and it came with its own set of problems like empty bullet points and lists, etc. final solution i came up to is get all the paragraphs that have images using beautiful soup and then loop through the paragraphs using docx to remove those that dont have images. here is the problem, there are images that are inside paragraphs with words around them, I tried using beautiful soup to remove those texts like: soup = BeautifulSoup(p._p.xml , 'xml') for txt in soup.find_all('w:t'): txt.string.replace_with("") print(soup.prettify()) document.paragraphs[i] =

Test if exception is thrown from a function that accepts user input

For an assignment I am trying to test whether a ValueError exception is raised depending on user input Here is my program that I am testing: def prompt_num_integers(): while True: try: # converting to int raises ValueError if input can't convert num_of_integers = int(input("How many integers do you want to store: ")) if num_of_integers < 1: raise ValueError except ValueError: print("Sorry, I didn't quite understand that.") continue else: return num_of_integers def prompt_integers(): # prompt user for number of integers then store that value into a variable num_of_integers = prompt_num_integers() # list for storing the integers integer_list = [] # integer for keeping count of current num of integers x = 0 while x < num_of_integers: try: # check if current num of integer equals total num o

Backup uploaded and extracted, but at 99% of DB restoration, I am getting errors while WP migrating (plugin "All-in-one-migration")

I created an EC2 instance and installed PHP, MySQL , Apache and WordPress. I configured the below four files: sudo vim /etc/php/8.1/apache2/php.ini Change maximum file size upload limitation. Upload_max_filesize, post_max_size, max_execution_time, max_input_time, memory_limit and max_file_uploads sudo vim /etc/apache2/apache2.conf .htaccess by (<Directory /var/www/> AllowOverride All) sudo vim /var/www/html/wp-config.php Set you DB credential and define('FS_METHOD', 'direct'); sudo vim /etc/ssh/sshd_config Set password authentication Plugin ---- All-IN-ONE-MIGRATION Stage >> File Import 100% extract 100% Getting error in 99% of DB restoration GET https://35myip6/wp-admin/admin-ajax.php?action=ai1wm_status&ai1wm_import=1&secret_key=x2huyD7Y84n0&_=1704795105444 net::ERR_CONNECTION_REFUSED load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.4.2:2 POST http://35.myip---18/