Howto: Use Charm like a pro

A few weeks ago, I committed the sin of whining audibly into the Internet about the lack of a proper blogging client that didn’t have ties to the Gnome underbelly. Well, I am going to admit my mistake now, and graciously accept my double-serving of humble pie.

Because I found one that not only doesn’t require Gnome, but it runs from the command line. And you know what that means, boys and girls. That’s right, it means you don’t have any excuses any longer. Drag out your old Pentium, because it’s being recommissioned.

The main things I needed from a blogging “client,” as I called it, were the ability to manage and edit posts, publish new content, and maybe edit links or manage images. People like screenshots, you know.

Charm does two out of those three, and gives you the ability to handle the third however you want. It’s a natural for the mundane tasks of updating, editing or managing blog content.

Technically, it doesn’t do any actual editing, or at least not in the conventional sense. For that task it very wisely allows you to configure an external editor, and directs your creative efforts to the application of your choice. Charm isn’t a writing suite, it’s a nifty tool for handling the nuts and bolts.

Charm is a Python-based program, which means it’s a snap to download and use, and install. Let’s grab the newest version, which was updated only about two months ago.

wget dl.sourceforge.net/sourceforge/ljcharm/charm-1.9.0.tar.gz

Now unpack it. Feel free to put it anywhere you like.

tar xvzf charm-1.9.0.tar.gz

Believe it or not, so long as python is installed on your machine (and I’m 99 percent sure it is), you’re done. You can start using it now.

Technically. Before you go any further you should set up a configuration file, because unless you tell Charm where to go, it’s just going to smile weakly and quit. As it should.

Start a file in your home directory and call it .charmrc. Here’s the guts of my configuration file, modified only slightly, of course.

metaweb = kmandla XXXXXXXX https://kmandla.wordpress.com/xmlrpc.php
editor = nano

Charm can handle WordPress, Blogger, Moveable Type, LiveJournal and a mess of other common blog hosts. WordPress uses the metaweb indicator, so I’ve followed it with my account name and password (no, my password is not really a string of X’s) and the xmlrpc address for my blog. And really, aside from that, there’s not much setup that’s required. You can run Charm from the decompressed directory, just by triggering it through Python.

python charm

Or if you prefer a system-wide installation, you can install it with this command, as the root user (in other words, Ubuntunuts need a sudo before this line):

python setup.py install

From there, it’s as easy as typing “charm” at the command prompt. Which should, barring incident, give you a menu interface that looks a little like this.

As you can see, Charm has already connected to WordPress.com, signed in and is awaiting further instructions. Now I can manage the content of my blog by working through the submenus. For example, to set up this post, I first pressed P, for the blog posting menu.

Writing a new post only requires that I press the E key, which brings up nano. Remember, Charm isn’t a writing suite. It just handles the nuts and the bolts. But you should like that, since it means you can arrange to use whatever writing program you like, be it Abiword or OpenOffice or Microsoft Word running under Wine And yes, you vi-weenies can use vi too. 🙄

I used nano here, but nano’s not really very conducive to writing, is it? What would be nice is if there was a console-based program specific to writing, without too many pointless features or random, unnecessary flair. Something for just for writing.

Oh, wait. I know. …

Yes, Charm and WordGrinder go together like peas and carrots, peanut butter and jam, or chocolate and milk. There’s only one small fault in the arrangement, and it’s something WordGrinder needs to overcome: You can’t import a file from the command line with WordGrinder.

WordGrinder can open its own file format, but Charm needs to be able to spit out a command that triggers the editor and the file. Unless you find a way to make the two hold hands neatly, you might find yourself using nano or another editor as a translator.

For my own case, I write in WordGrinder, export to text or html, trigger nano in Charm and then splice (“insert”) the text file into the dummy file that Charm created. It’s not ideal and I plan to submit a feature request for WordGrinder that would smooth that over, but for the mean time it works okay.

Let’s continue. Once the text of the post is complete and saved, we should add a title — a “subject.” From the Blog Posting Menu, the S key will do that.

And we should probably add a category. Pressing C tells Charm to screen the current categories available, and offer them for your perusal.

Notice that there’s also the option for tags; I never use them, which is why mine is blank. (I don’t see a difference between tags and categories, honestly. I’ve been over the definitions many times and tags seem redundantly redundant.)

But that’s about all you need to put something online. Here’s one last look at the posting menu before publishing.

Charm can wrangle existing posts too. From the main menu, the E key gives you the chance to screen through the posts already online or delete them completely.

Of course, if you want to edit a post from two years ago, you might prefer to do that the old fashioned way. Time spent downloading the list might be offset by the time it takes a Celeron to work its way through the WordPress.com backend. …

Charm doesn’t do some things, like allow you to rearrange blog widgets or scan your traffic stats. But again, those are shiny sparkly things that WordPress.com handles internally, and looking for them in a blog client would be stepping beyond the bounds of the original needs.

Charm has a lot of other options, and a lot of features that are aimed at different blog services. For that reason I don’t have much more of an introduction for you. The best part of Charm is this:

There it is, using up a massive zero percent of my processor time and a meager 2.4 percent of my 192Mb of memory. So roughly, 4.6Mb, which is a hair’s breadth when compared to any browser (except maybe elinks) wading through the WordPress.com blog management pages.

Now here’s the bad news.

I haven’t had much luck publishing a new post with Charm 1.9.0, because of an odd Python error that crops up. I’ve tried with Python 2.6.1 in Arch and Crux, as well as 2.5.2 in Hardy, and results are always the same. I can edit posts and follow all the other functions, but publishing a new post isn’t happening for me. It’s something that has been confirmed by other Charm users, but needs corrected. If you know any Python you might be able to accelerate the process; the bug report I filed (in the wrong section, I might add), is here. And of course, since I’m using WordPress, it might work better (or completely) on another host, or even an earlier version.

Otherwise, all Charm’s other functions work great. And I’m sufficiently pleased with Charm to use it on a regular basis, mostly because it allows me to keep using the machine I prefer for typing. Moreover I think between WordGrinder and Charm, the biggest blabbermouth on the Web would be able to keep their lips flapping and satisfy their need for affirmation from the anonymity of the Internet. And that’s what it’s all about, isn’t it? 😈

29 thoughts on “Howto: Use Charm like a pro

  1. reacocard

    I think I found the bug. That particular error (NameError: global name ‘datetime’ is not defined) is caused by the datetime module not being imported properly. If we go back up to the top of ljcharm.py, we see its import statement looks like this:

    try:
    import feedparser
    import httplib
    import base64
    import datetime
    import sha
    atom_ok = 1
    except:
    atom_ok = 0

    so, what its doing here is trying to import each of those modules in turn. If it gets them all, it sets a flag so it knows it got them. Otherwise, it just unsets the flag and continues merrily on its way. Problem is, if a module fails to import, none of the succeeding ones will get imported either. As feedparser is the only module here not in the python standard library, I’d rewrite it like this:

    try:
    import feedparser
    atom_ok = 1
    except:
    atom_ok = 0

    import httplib
    import base64
    import datetime
    import sha

    Now all those modules, including datetime from the error message, should get imported properly. (note: sha will give a depreciation warning) I haven’t tested this myself, but based on my knowledge of python it should work.

    Reply
  2. reacocard

    blarg, wordpress screwed up the indenting in my code. The revised version should have these lines indented:

    import feedparser
    atom_ok = 1
    atom_ok = 0

    all other lines should not be indented.

    Reply
  3. Onyros

    @ reacocard,

    It worked, mate! Brilliant! Thank you very, very much, this is perfect!

    I had used Drivel for a long time, but it was problematic, and sometimes didn’t quite work as expected. Charm works like a charm!

    Also, thank you K. for yet another great app to add to my list 😀

    Reply
  4. Onyros

    BTW, I’m getting an error when I try to retrieve and edit something that’s already been posted, but it happened before these changes, so I’ll try reporting it “upstream” 😉

    Reply
  5. Onyros

    Well, I got a very quick reply from the developer, so for anyone who’s having troube editing previously posted entries – with Charm throwing out a “KeyError: ‘mt_keywords'”, this is the solution:

    Change the line that says:

    self.Params[“prop_keywords”] = entry[“mt_keywords”]

    to:

    if entry.has_key(“mt_keywords”):
    (indent) self.Params[“prop_keywords”] = entry[“mt_keywords”]

    It worked, so Charm is now my fully-endorsed desktop blogging client, and many thanks to evilhat for taking care of that so promptly, with a fix that’ll be included in Charm’s next version.

    Reply
  6. K.Mandla Post author

    That’s great. 😀 Now I need to transfer this entire system to my Pentium, and I can at last blog in style. 😛

    Thanks for all the help folks. This is how things are supposed to work! :mrgreen:

    Reply
    1. K.Mandla Post author

      The bug tracker seems to be well monitored, so if you can trace it to an error you might have some luck getting a reply. Or a fix, for a future release. I believe the line-swap mentioned above is in the 1.9.1 update, but I haven’t tried it yet.

      Reply
  7. Pingback: Case in point: Charm at 100Mhz 16Mb « Motho ke motho ka botho

  8. karthik

    Charm looks brilliant! Thanks a lot for the find, and for the post.

    I know you mentioned there’s an option for WordPress tags- but as far as I know, the MetaWeblog API does not offer an option to handle tag data. (I think the most it can do is to list an existing post’s tags, not create new ones.)

    So, um, any idea if the tags option works?

    The lack of tags functionality is the only gripe I have with Vimblog, and I intend to shift to Charm if it handles WP tags well.

    Reply
  9. K.Mandla Post author

    I”ll be perfectly honest and say I don’t use tags, so I haven’t tried pushing them through Charm yet. Give it a try and see if it does like you want, then let us know. 🙂

    Reply
  10. Pingback: Settling in at 100Mhz « Motho ke motho ka botho

  11. karthik

    Tested- WP tags are handled like a charm.

    I’m still getting to grips with how this is managed- as per the official documentation, there is no method of obtaining or adding tags. My knowledge of Python is fairly rudimentary, so parts of the script (like the tag-handling) are a mystery to me.

    Oh, well, it works!

    Sometimes I wonder what the point of going to great lengths to find lightweight tools for use in a dual core machine (with tonnes of RAM) is, but thankfully, this phase fades quickly.

    Reply
  12. urukrama

    Thanks for this, K.Mandla. I’ve finally set it up on my computer and it works great.

    The difference between tags and categories, by the way, is that categories are blog specific: they help you organise the post you’ve posted on your blog. Tags on the other hand span all the blogs on WordPress. If you click on a tag, you’ll see any WordPress blog post that has those tags.

    I add tags to my own posts, but never really use them. According to the WordPress statistics, I get a lot of traffic to my blog from those tags, though.

    Reply
  13. Pingback: Still looking for … « Motho ke motho ka botho

  14. FND

    Thanks a lot for this!
    I’d tested GNOME blog before, but that didn’t really satisfy my needs. Charms seems just right, and gets the command-line bonus!

    Reply
  15. Pingback: » Testing GNOME Blog FND’s Blag: Just Another Personal Wobsite

  16. Pingback: More console apps, for future reference « Motho ke motho ka botho

  17. Pingback: Desktop Blogging Client For Linux « L3ftm1n0r

  18. Pingback: A Crux port (and patch) for Charm « Motho ke motho ka botho

  19. Nathan Grubb

    Wow, I just tried it. I like it more than the wordpress interface, but it’s annoying that nano doesn’t wrap lines (perhaps I’ll use another editor, I chose nano for simplicity since I didn’t want to insert a random x in my post like I frequently do with emacs, or a :wq with Vim)

    Reply
  20. Pingback: charm test « Disparaging Thoughts

  21. Andy

    Has anyone got this to work with blogger? I’ve seen that it uses code that says (“www.blogger.com”, “/atom/”, 1) in it’s ljcharm.py module.

    But with a webadress like mindofmoney.blogspot.com, there is no /atom in the link, causing it to fail. It doesn’t find the page. I tried removing the atom part in the code, but then it gives some code that the page temporarily moved.

    People seem to be using it though, so maybe someone else here has any experience with charm + blogger? 🙂

    Reply
  22. Pingback: Taking Puppeee out for a walk « Andy C.'s weblog

  23. PeterStJ

    Nice little application, however it misses one very important (imo) option – search text in previous entries (as taken from logjam – gtk livejournal blog application) that has prooved to be very usedful. Actually I start it (logjam) only when I need to search text in my blog and I do my editing in vim with some python scripts to communicate with livejournal server. It does the trick by archiving the whole blog locally as sqlite DB and perform the search locally on the data. Thus it does not rely on google or other search engine to look for your search term in your own blog.

    Reply
  24. Pingback: (no subject) | riceissa

Leave a reply to rpj8 Cancel reply