RAW Images in Lightroom Show Blank Screen

plugin: Adobe Camera Raw
program: Adobe Lightroom

The Problem

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.

The Solution

Adobe has a program called Camera Raw. Download can be gathered here. It is a plugin for most of the Adobe suite that provides support for RAW files from your camera.

Raw files contain the most complete, uncompressed image data but in a form that is not directly usable and must be processed.” ~ Borrow Lenses

Take special note of the note at the top:

For older Adobe applications, substitute with the Camera Raw 10.5 installer below.

There are pretty clear steps on the Adobe site and which installer you should choose there.

Hope this helps!




Python Error: Unsupported Pickle Protocol 5

python ide: Spyder
os: Windows
package: Pickle5
package: Pickle

Introduction

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.

The Problem

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 Solution

The simple solution may have been to install the package pickle5:

pip install pickle5

which:

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.

Hope this helps!




Troubleshooting Task Scheduler Running a Python Script

program: Python
package manager: PIP
ide: Spyder

The Background

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.

The Problem

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.

The Solutions

Yes, plural solutions. There were lots of things wrong.

First

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’

Second

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.

Third

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:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools

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.

Create a *.bat File

Head to this other post I’ve made on How To Create a *.bat File in Windows For Task Scheduler To Run Python Script. It should give you all the details.

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.




How To Create a *.bat File in Windows For Task Scheduler To Run Python Script

If you would like to run your Python script without having to open your IDE to complete a task, you can do so by creating a *.bat file. I’d be interested to hear what other reasons why you found this page to create your *.bat file in the comments below, because I’m sure there are some pretty cool tasks out there you are doing.

The format of the *.bat file is as:

“<location to python.exe file>” “<location of your python.py script you want to run>”

For me, this looked like:

“C:\Python\Python39\python.exe” “C:\Python\Python39\programs\coolProgram.py”

Saving the File

Saving the file is the tricky part.

Make sure you have the drop down save as type selected to *.*. If you don’t your file will save as filename.bat.txt.

To avoid any file location issues, I’d suggest saving this *.bat file in the same location you have your python script in.




Changing Memberpress Recurring Product Description at Checkout

Software: WordPress
Plugin: Memberpress
Plugin: My Custom Functions

Overview

Memberpress is a plugin for WordPress that allows the owner of the website to create a powerful member based website. It allows you to lock out certain pages unless the user has signed up for a specific membership, all based on rules you set in the backend.

When a user purchases a membership on the website, they are directed to a payment portal that has the description of what they’re about to buy and asks them to input a payment method. It looks something similar to this.

Memberpress Checkout Description Change

Changing Memberpress Checkout Item Description

Circled above is Initial Payment. It’s a setting that cannot be changed in the Memberpress dashboard in the backend. Why not?! Who knows!

I suspect that this description has something to do with selecting the recurring payment when creating the membership.

To change what it says here, a little Javascript is required. If you do not have a plugin installed, I would suggest using a plugin to insert the javascript. If you do not use a plugin, and instead edit the functions.php file, with one theme update, you will lose your customization and have to do it again (smart WordPress practice is to avoid this sort of issue). At the time of writing this article, My Custom Functions seemed like the smartest plugin to use to edit the php/javascript.

Once the plugin My Custom Functions has been installed, it is located under settings -> PHP Inserter.

Add the following code:

function change_checkout_description($args, $txn) {
	$membership = new MeprProduct($txn->product_id);
	$args['items'][0]['description'] = $membership->post_title . ' - Initial Payment';
	return $args;
}
add_filter('mepr-invoice', 'change_checkout_description', 10, 2);

In the above code, change ‘ – Initial Payment ‘ to what you would like it to be.

Save the custom code, and you should see changes reflected on the front end of your website.

Hope this helps!