The Undermine Journal Realm-specific Addon

Update 5/15/2012 – Well, I certainly hope we pulled last night’s attempt before anyone downloaded it and installed, it. If not, I do appologize for your empty addon directory. As has been said many times, backups are our friends. With any luck, the only install that was damaged was my own.

This build does not appear to have that problem. But still, be mindful and proceed with caution until you’re sure it won’t hurt anything.

If you have, like me, used The Undermine Journal for price research, you may have installed the addon that the author also makes available. There are two varieties; the generic one you will find on Curse and other similar sites ((I dunno, did they kill all the other addon sites off?)) and a custom one that you can download from TUJ itself.

The custom one can have up to four realms’ specific pricing data. The generic one uses an average of all realms.  I think you can see the advantage of the former – near real-time data specific to the realm you’re logged in to at the time.

The downside is that it is a little tedious to go and get the realm-specific build and install it every day or whatever schedule you follow.

Before the Crib was wiped out, we had this automated. Thanks to no good backups, this automation tool was lost forever.

Well, we’ve reengineered it, and we’ll share it with you.

What you will need:

  1. Python 2.7 or later installed. Do not install version 3 of any sort.  You can download Python here:
  2. A text editor that won’t make a mess of things. While NotePad will work, Notepad++ is better. You can find it here:
  3. An account on The Undermine Journal. If you don’t have one, go here and do so. It’s really nifty. You can use your Google or Facebook or Twitter account to authenticate. And who doesn’t have one of those?
  4. The technical acumen to create files, edit them, and move them around.
  5. The technical acumen to use a command line shell (‘cmd’ in Windows.)

Setting up TUJ

The first thing you should do is set up your account on The Undermine Journal.  Once you have done so, you need to set up which realm(s) you wish to obtain realm-specific pricing data for. Go to this page ( and scroll down to see something like this.


Control-click each realm of interest, up to four.

Now, the link to the right will have a custom URL that you can use to get your realm data.

Keep that web page open somewhere so you can go back and get that URL when you need it.

Setting up a workspace

This program is a slob and needs its own home. All of our work is done in d:grimmlabsproject_name, but you will have your preferences as to where you put this.  It should be a path that you can remember.  For example, C:TUJ.  Do that by opening a shell and doing the following.


Once you have the workspace, CD to that directory in your shell.

Creating the program

You can either download this file to your PC (It’s a zip file, you’ll have to unpack it.), or, if you’re the suspicious type ((To which I say, bully for you!)), copy the following and paste it into a file called, for example,  (Clicky on the little magnifying glass to show the code. Hover over it to see a toolbar with a few interesting features.)

[python collapse=”true”]
## (c) 2011-2012 by Jeff Grimmett
## Freely redistributable for all non-commericial uses
## including modification and improvement.
## Shine on you crazy diamond.

# See for the full
# set of instructions involved to use this script.

# Note: this can only be used ten times a day. After that, it
# goes boom, but it won’t do any damage when it does.

# Here are some variables you will need to change.

import os
import os.path
import shutil
import urllib2
import zipfile

# The URL to retrieve; will be unique for your account
# The location of your addon directory
TargetPath = ‘c:/program files/world of warcraft/interface/addons’

# These are some variables that you don’t need to mess with
# … and if you do, you better do it right or things will go "crunch".

# The name of the zip file, locally
LocalFile = ‘TheUndermineJournal.ZIP’
# The final path of the addon
FinalDestination = os.path.join(TargetPath, ‘TheUndermineJournal’)

print "Starting …"
print "Opening %s" %TUJURL

# Open the URL and local file
u = urllib2.urlopen(TUJURL)
f = open(LocalFile, ‘wb’)
meta =
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (LocalFile, file_size)

file_size_dl = 0
block_sz = 8192

# Proceed to download and update the display as it progresses.
while True:
buffer =
if not buffer:
# All done

file_size_dl += len(buffer)
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
status = status + chr(8)*(len(status)+1)
print status,

# Close local file

# Make sure we have a place to unpack
if not os.path.exists(‘unpack’):
print "Creating unpacking space"
print "Cleaning up last session"
shutil.rmtree(‘unpack’, True)

# Now that the file is downloaded, we unpack it.
print "Unpacking …",
z = zipfile.ZipFile(LocalFile)
print "Done!"

# Now that the directory is unpacked, we delete the old TUJ addon
if os.path.exists(FinalDestination):
print "Deleting old addon"
print FinalDestination
shutil.rmtree(FinalDestination, True)

# Now that the old TUJ is gone, this one is put in its place.
print "Installing updated version …",
shutil.copytree(‘unpack/TheUndermineJournal’, FinalDestination)

# All done!
print "All done!"

Everything between the quotes is the custom URL for your custom addon.  You will need to delete what is there ((That’s just a total fake in the example.)) between the quotes.

Go back to the Undermine Journal user page where your user account info is, and copy the URL for the link:


Paste that link in between the quotes, and save the document.

(2) Set up your addon folder’s location

By default, addons are assumed to live in c:program filesworld of warcraftinterfaceaddons.  If your system follows that convention, then there is nothing else to do. If, on the other hand, you have WoW’s addons living elsewhere, you will need to edit the following line.

# The location of your addon directory
TargetPath = ‘c:/program files/world of warcraft/interface/addons’

Note that this is the top level of the addons directory, not for TUJ itself.  The script will take care of that for you.

(3) Set up your environment

On Windows7, installation of the Python interpreter automatically registers the .py and .pyw extensions to the interpreter, so just running one from a shell will make it go.  On older systems, such as XP, you will need to add those extensions to the EXTPATH environmental variable.

You can also just include Python’s interpreter in your command path via the PATH variable and run it directly:

image showing python

… or use the full path.


If you have the extension registered, then you can just drag an icon to the desktop once you know things are running smoothly. Up to you.

(4) … and that’s it!

If we’ve done our homework properly, you’re ready to give this thing a try.

Open a shell and give it a whirl!


If you can’t figure out what’s going wrong from the error code, just drop me a line via the email link above or a comment below and we’ll sort it out.

Some Final Thoughts

  • This is in no way a bulletproof solution. The error handling is virtually nonexistent. I’m pretty sure it can’t do any real damage to your WoW install or OS, but if you have doubts, best to just move along.
  • TUJ only allows access to this custom addon ten times a day per account. You may hit that wall during installation and testing. My suggestion is to get a copy by hand first, so you can use it while you tweak the script. Or just be patient, the next day will be here tomorrow.
  • I intend to keep updating as I go along.  First priority is error handling. Next is a nice installer to make life easier. Next is a windows-only version that will run natively, no need for nasty interpreters.
  • This code should work on any platform that supports Python, including MacOS or whatever they call it today.
  • I’m sure I’ve overlooked a zillion things. Software projects generally involve a bit of beta testing which exposes these things. This app has received none.

Posted on May 15, 2012, in Addons, Hackity Hackity Hack. Bookmark the permalink. 2 Comments.

  1. Thanks for the updater 🙂 If anyone else is having the same issue I had, of realms with a ‘ in their name, like Vek’nilash, then replace the ‘ with %27 and it will work


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: