Reise45
Reise45

Reputation: 1203

Python cannot find file to send as email attachment

I am using Python3 and mime.multipart to send an attachment. I was able to send attachment successfully. But today, I get an error saying file does not exist, when I can see in WINSCP that it clearly does. Is this a permissions issue? Also when I list the contents of the directory, the file DOES NOT show up. What is going on?

Upvotes: 0

Views: 168

Answers (1)

Reise45
Reise45

Reputation: 1203

I wasn't closing the stream after writing to the file. So the code couldn't find the file. However when the script finished, the stream would get closed by force and I would see the file in the folder.

Upvotes: 1

Related Questions