“Could not complete your request because of a program error” when saving as PSD in Photoshop 7.0

Today I had a strange error while trying to save an image in Photoshop 7.0. The image was opened as a JPG and I was trying to save it as a regular PSD file.

Could not complete your request because of a program error.
Could not complete your request because of a program error.

It turned out that the JPG image must have some corrupted metadata. The solution was to go to the File | File info... dialog and uncheck the field labeled: Preserve Additional Information prior to saving.

Photoshop File Info dialog
Photoshop File Info dialog

Resetting Photoshop Preferences

Sometimes, Photoshop can exhibit unexpected behavior.

One of the solutions is to try to reset the Photoshop Preferences. There are various ways to do it, as outlined here. One way is to hold Alt, Ctrl and Shift keys while the application starts up. You will be asked if you want to delete the Adobe Photoshop Settings File, to which you should answer “Yes” if you are sure you wishlike to have it deleted.

Delete the Adobe Photoshop Settings File?
Delete the Adobe Photoshop Settings File?

You should also take note, that this means resetting all your settings and preferences to “factory defaults”.

Save For Web

If the problems are only present in the “Save For Web” dialog try holding Ctrl+Alt while selecting Save for Web from File menu. You should be then shown a dialog enabling you to clear the Save For Web preferences. This may not work in all versions of Photoshop, as described here.

Hydrogen Renamer

TL;DR: This script will help you rename the Gantry 5 Hydrogen theme as a starting point for further customizations.

Recently, I’ve been trying out the Gantry 5 – a theme framework for WordPress. One way to get started with theme development using Gantry 5 is to take the default theme, called Hydrogen, rename it and customize it to one’s needs.

The whole renaming process is described here. It takes few steps, which involve unzipping the theme, changing names of files and directories and doing a find and replace for the word “hydrogen” written in few combinations of uppercase and lowercase letters.

I thought that the whole process could be easily automated with a simple Python script that would repack the theme on the fly while doing all the necessary string substitutions in file contents as well as in the paths.

The script is available here on Github. I hope that it will be useful for people willing to develop themes using Gantry 5 framework.

Safely removing SATA hard drive from a running system

I have a Debian-based system with a SATA controller running in AHCI mode. I sometimes need to plug and unplug a disk from an internal SATA bay. The bay is nothing fancy – you just slide a disk cradle into it and the SATA and power sockets make contact.

Wyzard on Unix & Linux Stack Exchange
has a good advice on how to do a proper hot unplug. The following is based on
that advice:

First you need to unmount the partitions. Then, deactivate any LVM groups with vgchange -an – I don’t use LVM, so I haven’t tried that. Finally, it is a very good idea to unregister device from the kernel and spin it down by

echo 1 > /sys/block/(device name)/device/delete

Then I can hear the disk spin down, wait for it to stop completely and just pull it out. When I put in back in, it registers properly. Please note, that I am using AHCI mode in the controller.

How to spin down USB hard drive for safe removal

Let’s assume you are running a Debian-based system and have a hard drive at /dev/sdc with a partition /dev/sdc1
mounted. To safely remove the hard drive, first you need to unmount all its
partitions. In this case you may do:

udisks --umount /dev/sdc1

and then spin the disk down with:

udisks --detach /dev/sdc

You should the notice (usually, hear) the disk spin down.

Please note, that we are referring here to the device sdc not its partition

Thanks, user76204.

Remove all .pyc files from a git repository

When working on Python project you may sometimes forget to .gitignore your
*.pyc files and end up having them tracked by the repo.

To fix this you need use git rm:

find . -name "*.pyc" -exec git rm -f {} \;

Then, add a line:


to the .gitignore file in the repository root to have them permanently

Credit goes to Yuji.