0

so I'm trying to tell VSC to open 'proxylist.csv' which is in the same folder as Link_Beta.py (the file that is being worked on now)

My Code:

import requests
import random
import csv
import concurrent.futures


proxylist = []

with open('proxylist.csv', 'r') as f:
    reader = csv.reader(f)
    for row in reader:
        proxylist.append(row[0])


def extract(proxy):

    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'}
    try:
        r = requests.get('https://httpbin.org/ip', headers=headers,
                         proxies={'http': proxy, 'https': proxy}, timeout=2)
        print(r.json(), ' | Works')
    except:
        pass
    return proxy


with concurrent.futures.ThreadPoolExecutor() as executor:
    executor.map(extract, proxylist)

Errors:

Traceback (most recent call last):
  File "c:\Users\andre\Desktop\Python dsicord bot\link_Beta.py", line 10, in <module>
    with open('proxylist.csv', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'proxylist.csv'
PS C:\Users\andre> & C:/Users/andre/AppData/Local/Programs/Python/Python39/python.exe "c:/Users/andre/Desktop/Python dsicord bot/link_Beta.py"
Traceback (most recent call last):
  File "c:\Users\andre\Desktop\Python dsicord bot\link_Beta.py", line 9, in <module>
    with open('proxylist.csv', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'proxylist.csv'
Lucan
  • 2,907
  • 2
  • 16
  • 30
ykyk
  • 69
  • 1
  • 6
  • 1
    if i decipher this incredibly complex error correctly- it seems like either proxylist.csv doesn't exist or it's not in the same directory you launched the script from - it's also possible your current working directory is changed somehow and is not what you expect – AntiMatterDynamite Aug 29 '21 at 16:31
  • 1
    Does this answer your question? [Why am I getting a FileNotFoundError?](https://stackoverflow.com/questions/17658856/why-am-i-getting-a-filenotfounderror) – Lucan Aug 30 '21 at 14:46
  • What does this have to do with Selenium? – wjandrea Aug 30 '21 at 15:11

0 Answers0