I updated my laptop to Mac Os 14.3.1. I installed Python 3. The configuration/instruction page in the database exchange is missing. When I run my procedure I get this error message " /usr/bin/python (not installed)". When I look in /usr/bin/ I see python3. How do I solve this?
Thank you for your help.
It feels like âIf you give a mouse a cookieâ Iâve installed python3, its toolbox, Homebrew, its config pkg., Xcode. I donât know whatâs next but Iâm sure there is something.
No bother. Itâs important to me that this all works âas advertisedâ.
Python Is very picky about indentation. Staring any line with the wrong number of spaces will cause the type of error youâre encountering. But line 14 is truly a surprise unless youâve done some editing to the procedure; no accusations intended.
If youâre literally sending to mailto:me@xyz.com, thatâs certainly going to cause a sending error, but thatâs different than the spacing error and an indication that the procedure ran fully. That conflicts with the spacing error.
Mailbox shows a version number. What is yours showing?
Also, the Python error includes a path to a temporary file Panorama creates to send the message. Opened in an app like BBEdit, it shows exactly what line 14 look like. Youâre welcome to share that file but be sure to replace your email address, server, and password info with some nonsense to protect yourselfâŚ
I think he was suggesting that you open the file in BBEdit (or a similar editor) and then post the contents here on the forum, being careful to redact your personal info.
You can copy the text in BBEdit ( or whatever text app youâre viewing it in ) then paste it here. Ideally you then highlight it and click on the Pre-formatted text button above to format it properly.
Line 14 is: ââ . If this is the problem I imagine itâs going to happen a lot in this script. It looks like everywhere an email address goes it does this.
Thanks for looking at this.
Bill
#!/usr/bin/python3
import ssl
import smtplib
import mimetypes
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.mime.base import MIMEBase
from email import encoders
try:
#strTo = '''prog@hsoul.org
'''
strTo = '''prog@hsoul.org
'''
strFrom = '''H & Soul <prog@hsoul.org
>'''
strCC = ""
strError = ""
strImages = ""
msg = MIMEMultipart('related')
msg['Subject'] = '''Python Email'''
msg['From'] = '''H & Soul <prog@hsoul.org
>'''
msg['Reply-to'] = '''prog@hsoul.org
'''
msg['To'] = strTo
msg.preamble = 'This is a multi-part message in MIME format.'
# Encapsulate the plain and HTML versions of the message body in an
# 'alternative' part, so email agents can decide which they want to display.
msgAlternative = MIMEMultipart('alternative')
msg.attach(msgAlternative)
msgText = MIMEText('''An Email Settings Test prog@hsoul.org
@ 4:32 pmSent via smtp.gmail.com to prog@hsoul.org
''')
msgAlternative.attach(msgText)
msgText = MIMEText('''<p>An Email Settings Test prog@hsoul.org<br /> @ 4:32 pmSent via smtp.gmail.com to prog@hsoul.org</p><p></p>''', 'html')
msgAlternative.attach(msgText)
# Attach Any Images
images = ''''''.splitlines()
i=1
for image in images:
# print 'Image',i,': ',image,'\n'
fp = open(image, 'rb')
msgImage = MIMEImage(fp.read())
fp.close()
# Define the image's ID as referenced above
msgImage.add_header('Content-ID', '<image'+str(i)+'>')
msg.attach(msgImage)
i+=1
# Attach any files
files = ''''''.splitlines()
for file in files:
attachment = open(file, "rb")
part = MIMEBase("application", "octet-stream")
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header("Content-Disposition", f"attachment; filename= {file.split('/')[-1].replace(' ','%20')}")
msg.attach(part)
#send the email
smtp = smtplib.SMTP('''smtp.gmail.com''', '''587''')
smtp.ehlo()
smtp.starttls()
smtp.login('''ZZZZZ
''', '''XXXXX''')
smtp.sendmail(strFrom, strTo.split(","), msg.as_string())
smtp.quit()
except: print("Sending Error : "+strTo)
I did copy/paste originally but I just went thru and deleted any space and the last letter and then retyped it for every entry. Iâm still getting the same error.
Bill
Since it looks like you didnât follow Jimâs suggestion to redact this information, your gmail login information is now public on the interenet. So I would suggest that you change that ASAP, if not sooner!
I have to agree with Jim Cook, it appears that you have an extra carriage return at the end of the Sender Email Address, the UserName and the Reply to Address. I would completely delete all three of these (click in each field and press Command-A) and then manually type in each of these fields.
Ouch! I never got past the obvious returns at the beginning and didnât notice the failure to otherwise de-personalize the critical parts. I was able to edit them, but yes, theyâve now been hung out publicly and should be changed.
You may not see the fact that a Return is included if you click at the end of the email address since it amounts to a new line. Retype it or use the right arrow key to move the cursor to the right and beyond the ending âgâ. Itâll undoubtedly disappear after pong by the Return. Then the backspace key should allow you to back it up to the point where the g is absolutely the end.
The info in the Sender/Server/return is nonsense. It is not anyones info I know. Iâm going to download a new Mailbox and start over.
Thanks for your help,
Bill