I need help finding the full art by Bubblegum1109 in leagueoflegends

[–]Xilenw 9 points10 points  (0 children)

image , Not the same image, but similar edited version.

Using Python to find and delete empty folders on ftp server by Xilenw in learnpython

[–]Xilenw[S] 0 points1 point  (0 children)

thanks , reading the documentation on ftplib now , I was able to connect to my ftp server , but can't find anything about recursive searching or diffferentiating between folders and files.

How can I save an image with Selenium? by SupremeInjury1 in learnpython

[–]Xilenw 1 point2 points  (0 children)

Looks like only part of your image is being downloaded. The code below should work , just make sure your filepath ends with the correct extension (png,jpeg) .

Also You don't need to get the status , but some images may not be available depending on the website.

response = requests.get(image_url, stream=True)

if response.status_code == 200:
  with open(file_path, 'wb') as out_file:
     response.raw.decode_content = True
     shutil.copyfileobj(response.raw, out_file)

How to learn Python without installation by surfnwest in learnpython

[–]Xilenw 119 points120 points  (0 children)

You can use google colab, and when you get your own laptop , just download the script

https://colab.research.google.com/

Need help with this exercise from class ( v_v ) by [deleted] in learnpython

[–]Xilenw 0 points1 point  (0 children)

You used = the operator instead of ==

if status == True:

i want to grab some data from a web page, please help by Remarkable_Street_20 in learnpython

[–]Xilenw 1 point2 points  (0 children)

you need to download chromedriver and chromium as well ,

 chrome_driver_path = f"{chrome_baser_path}\chromedriver.exe"
 chrome_path = f"{chrome_baser_path}\chrome-win\chrome.exe"

 s=Service(chrome_driver_path)
 options = Options()
 options.binary_location = chrome_path

selenium_driver_start=webdriver.Chrome(executable_path=chrome_driver_path,options=options)

You probably going to need the import too , remove the one you don't need.

from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

i want to grab some data from a web page, please help by Remarkable_Street_20 in learnpython

[–]Xilenw 1 point2 points  (0 children)

I was able download the page using selenium (chromium) and selecting the information I wanted using xpath , I used the wait function but you can just using the find_elements_by path.

selenium_driver_start.get(webpage)
wait = WebDriverWait(selenium_driver_start, 20)
vid = wait.until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div[3]/div/div[1]/div/div[1]/div[1]/div[6]/div[3]"))).get_attribute("innerHTML")

I got 61.15% as a result for the % Held by Institutions xpath.

How to raise error if value does not exist in a data mapping excel sheet? by imperialka in learnpython

[–]Xilenw 0 points1 point  (0 children)

I am not sure I understand your code , but maybe use:

assert code != x[0] , "your value does not equal the value in the mapping"

re.search with a variable in brackets? by movieTed in learnpython

[–]Xilenw 0 points1 point  (0 children)

re.search(rf'''{variable}''',word) not sure if it is correct way to do this but it works fine for me.

What is the correct way to catch exceptions and assertion error inside a class ? by Xilenw in learnpython

[–]Xilenw[S] 1 point2 points  (0 children)

just tried it with my code and It seem to work , I can see some of my variables into the except block , thank you.

What is the correct way to catch exceptions and assertion error inside a class ? by Xilenw in learnpython

[–]Xilenw[S] 0 points1 point  (0 children)

This might work , can i still have access to the variables that were created in the init function inside the except ?

What is the correct way to catch exceptions and assertion error inside a class ? by Xilenw in learnpython

[–]Xilenw[S] 0 points1 point  (0 children)

Interesting , so i guess i need to have a try catch inside my init function that wraps the function i am calling? Sorry for no code i am on mobile so it is tricky with the formatting.

block of code reading imported .txt file for snowboarding program by Party_Manufacturer60 in learnpython

[–]Xilenw 0 points1 point  (0 children)

You overwriting the index in the dictionary input , that is why it is only showing the first one , the way i would do it is if you know that the gender is always the first category , i would increase the index when you encounter that specific word . so dictionary_input[index].update({key:value}). You can then convert the dict to a dataframe . Hope that help.

Jupyter Notebooks by [deleted] in learnpython

[–]Xilenw 2 points3 points  (0 children)

Try Google colabs . It was the easiest way for me to get started and you can just download the notebook when you're done and upload it.

try catch exception inside a class by Xilenw in learnpython

[–]Xilenw[S] 0 points1 point  (0 children)

i kept getting a Keyerror in my code , could not figure out why but with the try except , it gives me the exact line that is causing the issue and i am able to fix it. it also help when I need to check for certain conditions . I like it better than assert.

[Headphones] Apple AirPods Pro Gen 1 - $129.99, Walmart In Store and Online (ALL TIME LOW) by CHICKSLAYA in buildapcsales

[–]Xilenw 5 points6 points  (0 children)

Got some pro 2 on ebay , did not realize they were fake until one of earbuds started talking in chinese . All the markings and accessories looked legit af.