Using pygmynote to Manage Your Information

10 June, 2019

Information. We all deal with more than a bit of it daily. Notes, links, ideas, tasks, quotes, snippets, and interesting files. And how we deal with those pieces of information varies from person to person. Some of us store them in text or word processor files. Others use one or more online tools. Some of us even use reliable, old fashioned paper.

But no matter how you collect your information, managing it is always a chore. And while there are a number of open source tools for effectively managing your information, why not turn to the command line? One excellent command line tool for managing information is pygmynote.

Let’s take a closer look at it.

A little background

pygmynote is a Python script. So, obviously, you need Python installed on your computer. Luckily, it’s standard kit in most Linux distributions so you don’t need to worry about installing it.

As for installing pygmynote, that’s pretty easy. After you download it, extract the archive containing the script and its supporting files somewhere on your computer. You need to have write access to the directory into which you extract the archive; I put it in my /home directory.

Then, open a terminal window and navigate to the directory containing pygmynote. Once there, type the command chmod +x pygmynote.py to make the script executable. All that means is that you can run it by typing ./pygmynote.py instead of python pygmynote.py.

Your notes are saved in a database. Not, you don’t have to worry about installing a fully-fledged database system on your computer. Instead, pygmynote uses an SQLite database which is very compact. The name of the file is pygmynote.db. Just make sure you don’t delete it!

Running pygmynote

In a terminal window, change to the directory containing the script and run the command ./pygmynote.py. Your terminal window will look something like this:

pygmynote after starting up

That doesn’t look incredibly useful or helpful, does it? At any time, type help and press Enter to get a list of commands. Let’s look at some of those commands.

First off, you’ll probably want to add a note. To do that, type i. At the prompt, type your note. When you’re finished, press Enter. You’ll be prompted to type one or more tags. They’re optional, but tags make finding notes a bit easier.

Once you’re done, press Enter again. You’ll be asked to enter a due date – this is useful if your note is a task. Otherwise, it makes little sense to add a due date to any other kind or record. When ready, press Enter to save your note.

A new note

One interesting feature of pygmynote is the ability to add attachments to a note. Much in the same way you’d do that with an email message. To do that, type f. Type your note and then press Enter when you’re finished. As with a regular note, you’ll be asked to add tags. Again, you can add them or you can skip that step by pressing Enter.

When you do that, you’re not asked to enter a due date. Instead, you need to tell pygmynote the path to your file. The path must include the name of the file — for example, /home/scott/Documents/attachment.odt. The attachment can be any file: an image, a text file, a word processor document, a PDF, or an audio file. When you press Enter, pygmynote saves the note and the attachment.

Working with notes and attachments

In pygmynote, your notes are called records. Each record that you add is given a unique ID, starting at 1. If you want to view all of the records that you’ve saved, type a. pygmynote displays the records in numerical order, and gives you a count of the records.

A record in pygmynote

If you have tasks among your records, view them by typing tl and then pressing Enter.

Notice the items in square brackets in the screen capture above? In the second record, the brackets contain the tags associated with the record. The other two are blank. But one of them does contain an attachment. To view records with an attachment, type att.

A pygmynote record with an attachment

Notice the highlighted [jpg]? That indicates that the record has a JPEG image attached to it.

So what happens if you want to pull the attachment out of pygmynote? Type s. You’ll be prompted for the ID number of the record that contains the attachment. Type that number (if you don’t know it, use the att command beforehand) and then press Enter. You’ll be asked for the path and name under which to save the file — for example, /home/scott/Temp/typewriter.jpg. Type that information, and then press Enter.

Saving an attachment in pygmynote

One of the actions you’re supposed to be able to take is updating a note — either the note itself, its tags, or its due date. Unfortunately, I couldn’t get the update function to work. When I tried, pygmynote displayed the error Something went wrong. Try again.

Searching your notes

Let’s say you have a lot of notes. If you need information in one of them, it’ll probably be difficult (to say the least) to get that information by using the a command. Instead, do a search. To find a particular word in your notes, type n and then press Enter. When prompted, type the word that you want to find and then press Enter again.

You can also search for tags. To do that, type t and then press Enter. When prompted, type the tag that you want to find and then press Enter again.

Anything else?

You can save your notes as a CSV file that you can open in a spreadsheet application like LibreOffice Calc. Type w and press Enter. When prompted, enter the path and name under which to save the file — for example, /home/scott/Temp/myNotes.csv — and then press Enter.

You can also delete individual notes by specifying their ID numbers. Type d and then press Enter. When prompted, type the number of the note that you want to delete and then press Enter again.

Final thoughts

pygmynote is simple but it is flexible. Even if you’re not comfortable with the command line, it’s easy to use and can be a great substitute for a desktop note taking tool.

Scott Nesbitt