This is my code: import easygui
while True:
try:
print('Select your file')
proxyfile = easygui.fileopenbox('', 'Select your file')
proxylines = proxyfile.splitlines()
proxylinesamount = len(open(proxylines).readlines())
break
except (TypeError, AttributeError) as e:
print(f'Error. File isn\'t valid. Reason: {e}')
continue
For some reason it returns the following error:
expected str, bytes or os.PathLike object, not list
I understand that this is a TypeError but I simply can't understand what I'm doing wrong
proxylinesis a list and you're trying to open it as a file.