So, i'm trying to write something, but the interpreter throws this:
Traceback (most recent call last):
File "C:\superbad_backup\SuperBad Backup\www.superbad.com\scanner.py", line 21, in <module>
scan_path(i)
File "C:\superbad_backup\SuperBad Backup\www.superbad.com\scanner.py", line 12, in scan_path
for i1 in current_file.readlines():
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 56: character maps to <undefined>
The string i'm feeding it is "C:\superbad_backup\SuperBad Backup\www.superbad.com\submit"
Should i give up on this entirely, use another library or i'm being dumb?
EDIT: People are asking the code, so here is my spaghetti monster.
from os import listdir, chdir, getcwd
from os.path import isdir, dirname
dir_list = []
def scan_path(path):
for i in listdir(path):
if isdir(i):
dir_list.append(getcwd()+"\\"+i)
elif isdir(i) == False:
current_file = open(i)
for i1 in current_file.readlines():
if "onMouseOver" in i1 and ".gif" in i1 or "onMouseOver" in i1 and ".png" or "onMouseOver" in i1 and ".jpg" or "onMouseOver" in i1 and ".jpeg" in i1:
print(i)
break
scan_path("C:\\superbad_backup\\SuperBad Backup\\www.superbad.com")
for i in dir_list:
chdir(i)
print(i)
scan_path(i)
dir_list.remove(i)