On Sun, 26 Aug 2018 00:34:00 -0500, Hugo Casal
<
hcasalnc...@gmail.com> declaimed the
following:
>[image: image.png]
>Here the screenshot with the code and error messages.
PLEASE DON'T DO SCREEN SHOTS.
It's a TEXT CONSOLE -- you can cut and paste the text. A typical
console is only around 200 characters (bytes), not something that is 52000
bytes and is unreadable in my news client. I have to extract the image as a
separate file and open it in a graphics viewer to see it. And even then it
is too coarse a resolution for easy reading.
>Do you have some suggestion that I can to use to eliminate this errors? I
First: You managed to cut off the bottom of the error traceback so
there is no indication of the real error message. We need the entire
traceback for debugging purposes.
Second: You are entering your code in the interactive prompt, so
figuring out what line number in the trace back maps to a line in the
source is difficult. Put your code into a file, using your favorite editor,
and run it using
python the_source_file.py
(or python3 if you prefer to use that instead of the default python 2)
Using a file also means you don't have to retype everything when you
make a mistake.
THIRD -- YOU NEED TO CHANGE YOUR PASSWORD FOR THAT ACCOUNT. YOU JUST
SENT THE PASSWORD TO EVERYONE READING THIS GROUP!
Fourth: you are using gmail, which is a mess to use when not coming in
through their web-site; they change certificates every couple of weeks
which plays hob with old mail clients that don't know about the newest
certificate servers, and require one to do special actions if not using one
of their approved clients.
https://www.wpsitecare.com/gmail-smtp-settings/
(read the part starting with "Gmail Wants to make Your Life Difficult"
>would like to learn python step by step before to write a code for beagle
Using complex internet protocols as a "beginner" is /not/ learning
"step by step". {granted -- a week after discovering Python for the Amiga
[version 1.4, I think], I did write a minimal outgoing SMTPd controlled by
an AREXX submittal script invoked by AmigaELM... But I also have an old
degree in comp.sci. and spent some time reading the SMTP related RFC and
the source code for the SMTPd that was NOT working correctly [it wasn't
handshaking CC and BCC addresses, so only TO recipients were getting the
email]}.
As a beginner for the language, you should read the Python Language
Reference
https://docs.python.org/3/reference/index.html , the Tutorial
https://docs.python.org/3/tutorial/index.html , and chapter 4 of the
Library manual
https://docs.python.org/3/library/index.html . (Those should
be available packaged with most Python installs, but I can't state what
Debian does with them -- ActiveState packages them as Windows Help files).
For the BBB, you'll also want to look at the documentation for
Adafruit_BBIO
https://adafruit-beaglebone-io-python.readthedocs.io/en/latest/
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/using-the-bbio-library
(you can download a PDF from the second)
Fifth: Toggling an LED on the BBB is going to be much easier than
configuring to send a properly formatted email message. See the email
format RFC
https://tools.ietf.org/html/rfc5322 . At a minimum, you need a
few headers and a body; the body is separated from the headers by a blank
line. Your "moviemento" (or whatever it was) is being seen as an unknown
header field. Consider:
text = """\ #backslash so the newline is NOT included here
TO: <stuff in some address>
FROM: <stuff in another address>
SUBJECT: example email message format
DATE: <put in some date>
This is the body, it must have a blank line before it,
and can be any number of lines; please break the lines
at less than 80 characters (70 preferred).
"""
Rather than formatting that by hand, read the documentation for the
email module
https://docs.python.org/3/library/email.html
{Note: I used the interactive mode as I was discovering what the module
does; it didn't exist back when I wrote that SMTPd; also, it is undergoing
some changes -- Python 3.6 adds message.EmailMessage with different
methods}
>>> from email import message
>>> from email import generator
>>> from email import utils
>>> em = message.Message()
>>> em["To"] = "Me Myself and I <
wlf...@ix.netcom.com>"
>>> em["From"] = "Me and My Shadow <
wlf...@ix.netcom.com>"
>>> em["Subject"] = "Example email message format"
>>> em["Date"] = utils.formatdate()
>>> em.set_default_type("text/plain")
>>> text = """This is the body, it must have a blank line before it,
... and can be any number of lines; please break the lines
... at less than 80 characters (70 preferred).
... """
>>> text
'This is the body, it must have a blank line before it,\nand can be any
number of lines; please break the lines\nat less than 80 characters (70
preferred).\n'
>>> em.set_payload(text)
>>>
>>> import sys
>>> emgen = generator.Generator(sys.stdout)
>>> emgen.flatten(em)
To: Me Myself and I <
wlf...@ix.netcom.com>
From: Me and My Shadow <
wlf...@ix.netcom.com>
Subject: Example email message format
Date: Sun, 26 Aug 2018 14:43:16 -0000
This is the body, it must have a blank line before it,
and can be any number of lines; please break the lines
at less than 80 characters (70 preferred).