You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Envelope.add_attachment could accept pathlib.Path object
if the path is a folder, then compress it and send the compressed file.
Following is a part of my command line tool
path = args.pathname
if path:
if path.is_dir():
# compress the folder before submitting
# compressed file is named by subject
compath = path.parent / (args.subject+".7z")
subprocess.run(["7z", "a", "-t7z", compath, path])
envelope.add_attachment(str(compath))
elif path.is_file():
envelope.add_attachment(str(path))
envelope.send(...)
print('The email is sent to ...')
if path.is_dir(): # delete the compressed file finally
os.remove(compath)
The text was updated successfully, but these errors were encountered:
Following is a part of my command line tool
The text was updated successfully, but these errors were encountered: