kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

It throws an exception when running on windows 10 cmd.exe after packed into an .exe script by pyinstaller command #270

Open xiawenniu opened 10 months ago

xiawenniu commented 10 months ago

OS: windows 10 python version: 3.12.0 package version: 0.15.293 pyinstaller version: 6.1.0

Description: I use pyinstaller to translate this python script to executable script on windows 10 and run it, but an exception is avoided below:

Exception ignored in: <function SMTP.del at 0x00000262924C8900> Traceback (most recent call last): File "yagmail\sender.py", line 261, in del File "yagmail\sender.py", line 203, in close TypeError: catching classes that do not inherit from BaseException is not allowed

Code like this :

yag = yagmail.SMTP(user=sender_account, password=sender_password, host=smtp_server) try: yag.send(to=row[EMAIL_INDEX_NAME], subject=subject, contents=content, attachments= attachment_path) time.sleep(30) except BaseException as e: print(e)

yagmail.SMTP.close

xiawenniu commented 10 months ago

When running in python environment, it doesn't throw this exception.