Email programs sometimes do funny things to email addresses. In Thunderbird by default, outgoing email addresses are added to a ‘collected addresses’ address book, and then other addresses that you say you want to add to your address book are added to Personal Address Book (unless you’ve changed it). This leads to address chaos.
Amalgamating address books / contact lists is definitely something good to do.
It’s actually very simple to do in Thunderbird, amalgamating or merging address books.
Open Thunderbird -> open address book -> if it’s not already there, make sure you’ve got directory pane opened from View -> select the address book you wish to move -> select the contacts you wish to move (ctrl+a works for all) -> drag them to the address book you wish to add them to.
All the better if the address book you’re merging into is synchronized somewhere.
Don’t forget to also check out the default settings so that each of your email accounts saves email addresses where you want it (for me, this is one single address book that’s synchronized between all of my devices).
Google is constantly changing the layout of their backend and also modifying how users authorize apps to use their APIs. It seems like it’s ever increasingly complicated, but I digress.
With any website, it is nice to have the capacity to send mail. This is useful for contact forms, but also for error messages and automated scripts. One can use the built in PHPmail() function, but connecting with proper SMTP mailer is ideal, in order to have proper security and avoid getting emails bounced.
WordPress now has many plugins that allow you to use the Gmail API to send mail from your website. Problem is that Google, at the time of writing this, has pretty strict authentication standards: OAuth 2.0 protocol.
For this solution, we’ll be using the WP Mail SMTP plugin, but there are others that authenticate in the same way.
First, install WP Mail SMTP from your ‘Add New Plugin’ section of the dashboard.
Quick search for ‘gmail’ will give a list of all the plugins to install, I like to use WP Mail SMTP.
Once activated, you can browse to the Settings page of the plugin and start entering in the details.
Fairly simple. Much like any other plugin install. Except now, you’ve got to enter the sphere of Google Cloud Platform, a confusing, convoluted world of programmers.
Google Cloud Platform is where you want to go now. Here you’ll give WP Mail SMTP access to use your Gmail account.
First, you’ll need to create a project. Name this project something meaningful, you might have to reference it again.
Once it’s created, make sure you’ve got it selected from the drop down menu at the top of the screen, and navigate to the APIs and Services tab and select Credentials.
From here, select Create Credentials from the top and select OAuth.
You’ll be directed to the consent screen for OAuth, this will be a web application.
Here you only need to add the redirect URI given to you by your plugin, in this case it will be
from WP Mail SMTP settings page on your WordPress site. Click create and you’re almost there.
Head into the OAuth Consent Screen tab, where you want to move this now into published mode.
After this, you need to now give the Gmail API authority to make emails on your behalf. To do this, you have to navigate to the Library within your APIs & Services screen and search for Gmail API.
Select the Gmail API and enable the service.
To finally get the Client ID and Client Secret, click on the Credentials tab and you will see under the OAuth 2.0 Client IDs will be the ID you just created. On the right hand side will be a little button to edit the key, if you click that, you will be able to find your Client ID and Client Secret that you will have to copy/paste into the WordPress Plugin WP Mail SMTP settings.
Once you’ve copy/pasted the settings into the WordPress WP Mail SMTP settings page, click save settings and your page will refresh and this section will now have a big orange button asking you to allow the plugin to send emails using your Google account.
After clicking that big orange button, you will be asked to authenticate yourself using your Google account, make sure to select the right Google account to use for this, which is the account you used to setup the whole API Key above from the start.
Once you have successfully linked WP Mail SMTP with Google API, you are now ready to send a test email to see if it’s actually working.
This is becoming quite tedious to setup Gmail to use as your website emailer. It would seem more logical to take a relaxing walk around the block than to go through with this again!
However, remember that Google does this all to make sure that the emails you’re sending are actually from you and not hijacked to create spam. And also remember that you can only send so many emails using the Gmail API in a day, so be wary about email lists that a gluttonous.
It is also important to have your SPF, DKIM, and DMARC all configured if possible. This is done by setting the adding DNS records that you get from your Gmail admin console. The helpful links are beneficial to follow.
You may get an error message when you test with an email:
"message": "Gmail API has not been used in project XXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=XXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
If you do get this, follow the link it provides you to solve all your problems.
So, I got a new computer and installed Lightroom and imported all my photographs to get my new computer up to speed. I was able to view the images in the Library, but when I went into Develop, the viewing screen went gray/blank. This only happened with my original *.RAW/*.AWR photographs. With the JPG exports I had already created when editing the images and imported just now in a subfolder of the original photographs, they would all show up nicely without an issue.
It should be obvious that the *.RAW / *.AWR or whatever proprietary RAW file format your camera makes wasn’t recognized in Lightroom. Obviously this is an issue for most photographers since photographing in RAW is essential for maximum colorspace to be captured.
In a previous article on trying to discover why a program would run in Spyder, and then when I ran it in IDLE or from command prompt it would fail saying that the packages weren’t installed. The skinny of how to resolve this issue was from command prompt type:
pip install <package name>
The explanation of this is that when one installs Spyder, it has built in Python Interpreter, which can be discovered within Sypder -> Tools -> Preferences.
Within the console of Spyder, one can also run the command:
import sys sys.executable
and then from command prompt (or IDLE) you can run the same command (if you’re using command prompt, you’ll have to first enter into Python using the python command, which should be recognized because you have linked this command to a PATH or PYTHONPATH in your environment variables). If the two system paths match up (the location of python.exe), the exact same python packages will be used by both IDLE and Spyder.
However, if the system paths don’t match up it is likely that the two IDEs are running different Python environments.
After I installed the necessary packages that Spyder had come installed with that I didn’t have installed with Python I had separately installed, my program was able to run.
However, my program modified files, and because the two versions of Numpy that were being used were different, the following error showed up:
Python Error: Unsupported Pickle Protocol 5
The simple solution may have been to install the package pickle5:
pip install pickle5
This package backports all features and APIs added in the pickle module in Python 3.8.3, including the PEP 574 additions. It should work with Python 3.5, 3.6 and 3.7.
and then used that in my program running in Spyder where the Pickle error was being experienced:
import pickle5 as pickle
However, when trying to install pickle5 I experienced the issue:
error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools for Visual Studios”: https://visualstudio.microsoft.com/downloads/
I went about downloading this package, but it appeared it was going to download the whole Visual Studio which was about 1.5Gb and as a general rule I try not to clutter up my computer with this kind of massive downloads (like Visual Studio is). Although, likely as a programmer you’ll have to have this in some shape installed on your computer.
So, why not just change the Python Interpreter to the one I first installed on my computer, outside of Spyder, the same one IDLE runs. For me, this was the location: C:\python\python39\python.exe (as shown in the image above, and discovered with the command prompt sys.executable report we did above).
If you do this, and restart Spyder, you’ll likely get an error saying that the console was unable to load, and to install the Spyder kernels. This command solves that:
pip install spyder-kernels
One thing I learned from all of this was that Spyder recommends the programmer to install and setup Spyder using Anaconda (though they do have a curious Important note at the top of that page explaining installing Spyder without Anaconda might be beneficial to avoid package dependency conflicts, as we have just experienced issues with being independent ironically!). I’m not sure if all of this would have been eliminated as a result of installing Spyder using Anaconda, because when I created a scheduled task I was then running the program outside of Spyder. However, I’m sure that there is a way to install Spyder such that it uses the existing Python interpreter installed on the system, which would be using the same Python interpreter from the beginning, and it hopefully would have installed the required site-packages in the same folder.
Creating an automated or scheduled task on your computer in Windows or Mac is pretty awesome for saving time doing routine tasks, particularly routine scripts or program runs. However, when setting up the task in the Task Scheduler (Windows), there isn’t much of a GUI that shows what is happening with the program like there would be in an IDE.
I was setting up a Python script to automate. To complicate things, I use Spyder IDE to code in.
I created a *.bat file. Double clicked on the file to run the script, and a window popped up and quickly closed.
I doubled checked in Spyder to see if the program ran, sure enough, ran like a charm.
Yes, plural solutions. There were lots of things wrong.
The biggest problem was that Spyder seems to have it’s own package folder that has some built in packages like Numpy, Matplotlib, and Pandas. I’m sure there are others. So, when I run my program in Spyder, everything ran great. But when I ran it using my *.bat file, it was running without the IDE and therefore didn’t have the built in scripts.
To figure this out, I opened the *.py file (my program) using IDLE, then ran (F5). The shell told me:
import numpy ModuleNotFoundError: No module named ‘numpy’
pip install numpy
That’s the short answer.
The long answer is to systematically install each package that had been assumed to be installed in Python.
This is done by continuing to run the Python script to see why it crashes. This will happen with similar ‘ModuleNotFoundError’s as seen above. Each module not found, pip install that package.
pip install <package name>
The above command is typed directly into Command Prompt, if pip has been installed correctly.
One the program runs completely within IDLE, it should now run smoothly in the Task Scheduler.
Setting up a Task Scheduler might be a bit confusing. It’s an app or program on Windows now of the same name. It’s also found in the directory:
When you click create task you will be stepped through a few tabs to create the new task.
Name the task, select whether you need to be logged in for it to run or not, set your triggers which can be time of day or specific days, and action is the tab that holds the information for what program to run.
Creating a *.bat file to run your script is probably the easiest way to create your action in the Task Scheduler. Once your *.bat file is created, I would suggest going to the actual *.bat file and double clicking on it to confirm that it does work.
tip: insert some print code or a sleep() statement at the end of your code so that you can get a confirmation that it has actually run. Sometimes the programs run pretty quick and you don’t get any feedback that it’s run.
If your *.bat file runs properly, in the Action tab of the Task, add a new action, and browse to the *.bat file you created above and select ‘start a program’ as the action you’d like to accomplish.
This should now show up as a task in your task scheduler. To see if it’s going to work before you wait for your triggers to be hit, right click on the task and select run.
Hope this helps you troubleshoot your scheduled task in Windows.