I ran into some issues in the last week or so with getting my Planet-updating shell script invoked by CRON; it would run when I ran the script by hand, but it wouldn’t run when cPanel’s CRON spooler would try to invoke it. I was getting the following error:
Traceback (most recent call last):
File “./planet.py”, line 23, in ?
import planet
File “./planet/__init__.py”, line 23, in ?
from planet.truncate import _TruncateHTMLProcessor
File “./planet/truncate.py”, line 2, in ?
import textwrap
ImportError: No module named textwrap
After looking confused for a while, I talked to my local python guru, Stephen Granade, and he pointed something out to me: textwrap.py is a Python 2.3-era addition, so I probably had a Python environment issue. [My server has 2.2.x and 2.4.x installed. Silly cPanel.]
Armed with this knowledge, I futzed around for a while and figured out that my shell script was missing an invocation of the Python environment. I have updated it:
#!/bin/csh -f
cd /home/path/to/planet
/path/to/python/binary ./planet.py ./config.ini
Consult your system adminstrator if you don’t know /path/to/python/binary. If you’re the sysadmin and can’t find the Python binary, please ram your forehead into your desk repeatedly.
Thanks again, Stephen. I owe you a beer.
Posted in Planet, Shell Scripts.
I finally got enough determination to hack on Planet enough to make it work for me; having already built a shell script to update Planet via CRON, I decided to strip most of the extraneous HTML out of the included examples/basic/index.html.tmpl to create my own templates/planet.inc; a php include() statement later, and GFMorris.net is my own Personal Planet.
Posted in Planet.
Has Sam Ruby gotten you excited about PlanetPlanet, even though you don’t know Python from Perl? Got it running, but don’t have a clue how to get CRON up and running with a shell script? Yeah, that was me yesterday. Google provided some help, eventually, but I’ll break it down a little more for you:
- Make sure all your file permissions are right. Half of my hell yesterday was having done all the work as root but not having CHOWN’d and CHGRP’d as appropriate.
- Use your shell script to change to the appopriate directory before invoking planet.py. I’d never really had to do that, as I’m still a babe in the shell-scripting woods. But if you go in, cd to the /path/to/your/planet.py, then invoke ./planet.py /path/relative/to/config.ini, you’ll be rockin’.
My shell script looks like:
#!/bin/csh -f
cd /home/path/to/planet
/path/to/python/binary ./planet.py ./config.ini
Now, I simplified things by putting config.ini and planet.py in the same folder. If you didn’t [for example, if you're using examples/basic/config.ini just for funsies], you’d just invoke ./planet.py ./path/examples/basic/config.ini.
Thanks, Sam, for pushing me over the edge to play with PlanetPlanet. Now it’s time to get the templates like I want them so I can start using it in production.
Posted in Planet, Shell Scripts.
All the stuff from v0.0.1 is still valid, but I’m focusing on a smaller subset of problems for 1.0:
- CRUD of show metadata [place, time, etc.]
- Setlisting of shows.
Everything else is a bit ambitious, and I want to release code this year. In fact, I’ve resolved to do just that. The rest of it will just have to wait for future revisions … because honestly, I want to break the cycle with every free and open package I see, which is a long pre-1.0 period with perfectly good code in there, a post-1.0 bugfix period, and then a complete architecture revision for 2.0. Blah. I’m okay with frequent major revision rolls to reflect new featuresets.
Onward to the planning of the database schema to do this reduced scope! [Remember, I am an aerospace engineer. My "programming" course in college was FORTRAN 77.]
Posted in dev-ShowInfo.
A tip for all WordPress users out there who have unwieldy uploads folders in wp-content: take a bit of the chaos out by creating a bit of a hierarchy in your uploads folder!
Here’s what I do:
- Create a folder named “uploads” in wp-content.
Having a separte folder for the stuff I upload allows me to keep things a bit tidier in there. As you probably know, wp-content isn’t in danger of being overwritten when you upgrade WordPress, and so it’s a good place to stash stuff.
- Create folders by year inside uploads to store images, movies, etc.
If you’re like the rest of us normal folks, you aren’t very good at renaming images that you upload. All that stuff takes a lot of work. However, if you create year-based folders inside your wp-content/uploads/ directory, you’ll be able to start to pin down when you used that really goofy image of your cat.
The only issue with this approach is that you have to make sure to have a new folder on hand when the calendar turns over a new year. If you take the time, though, to make a list of things that you should do every time January comes around again, this is a quick-and-easy thing to add to the list.
One last thing: make sure to chmod all these image folders to 777—otherwise, WordPress won’t be able to work with them!
[Thanks to Amy Qualls-McClure for making this suggestion years ago.]
Posted in WordPress.
Recent Comments