Benzine
Benzine

Reputation: 556

Running Python script with import causing issues

I have a custom python script which sends emails, when I created it in Thonny and ran it all works fine. However when I try to run it at start up or in the terminal I get the following error:

sudo python sendcpuwarning.py Traceback (most recent call last): File "sendcpuwarning.py", line 2, in import sendmail
File "/home/pi/Scripts/sendmail.py", line 4, in from email.message import EmailMessage ImportError: cannot import name EmailMessage

Anyone know why this is happening?

Upvotes: 1

Views: 48

Answers (1)

Benzine
Benzine

Reputation: 556

Worked it out, the issue was I was calling python /script/location instead of python3 /script/location.

Upvotes: 1

Related Questions