Python create Daily Planets Epheremis, Email & Automate

After creating a visualisation of planets orbiting in the solar system I wanted to see if I could create a daily Epheremis of planetary bodies for my particular location with Altitude & Azimuth locations at hourly intervals and then send it to myself via an email so that I could access it on my mobile phone if I was outside.

The end result is not aligned quite properly on the page and the text is a bit small, but I was interested in getting the process right so that I could automate it from start to finish, and from that point I get a daily delivered email to my inbox with a pdf attachment with the epheremis information for where I live.

PDF Table with Epheremis information for hourlyy intervals from a CSV output from a python script.


In producing the Epheremis (a table showing the positions of a heavenly body on a number of dates in a regular sequence) the script produces the data in a CSV format. That format is not that useful to view on a small screen, so I wanted a different format.
So an extra bit of learning was to convert the CSV output into a PDF table. A PDF is better than an image as it does not pixelate when you zoom in on a part of the image, so it is useful on small screens.
The PyEphem library was great and produced the tables very quickly in the format that I wanted (Alt/Az instead of RA & Dec) and I checked a couple of the results with Stellarium, just to see that I was in the right ballpark.
So I had the content that I wanted, I just needed it in the format that I wanted and then I had to look at a delivery process, in this case via email.
The email process threw me a bit as I’d only used CSV attachments to emails and that automation reads the attched file before sending it, so I needed to reconfigure the email code to be able to add a PDF attachment.
PyEphem library, Python FPDF2 library & Stellarium to check/verify if the setup is correct

Create PDF Tables with Python FPDF2 video

Github repo for code for video above:
Sending Emails With Python Including Attachments (New Method for GMail – 2022):

LINK to my Python Script Files:
The last part of the procedure was to automate the task.
Use Task Scheduler – setup new task. I had some difficulty getting this to run on my PC but it works fine on my server.