wilmens™

by William W. Mensah

This is a question you’ll probably be asking after you install and run myDiary 4.2 (GTK) for Windows. It’s ok, I asked myself the same thing when I tried the application on a different computer other than the one I’d created the ported version on. This is what it looked like:

?

myDiary with squares for text

myDiary with squares for text

?

This happens when the application can’t find the library files it needs to run correctly. For the case of the fonts, some pango files/modules could not be found, if not all. Basically, the solution is to make sure you have GTK 2+ Runtime Environment on the system you’re trying to run the application. This will make available all the dynamic link libraries and python modules needed by myDiary.

A GTK installer comes with myDiary’s installer. When installing myDiary, make sure the box where you’re asked if you want to install GTK is checked and also make sure you go through GTK’s installation process after myDiary is installed. If you ignored this the first time you installed myDiary (GTK), simply reinstall it. This should fix both the issue with the text and images and you should have myDiary in all its beauty:

?

?

myDiary (GTK) with text and images

myDiary (GTK) with text and images

If you still can’t get it to work after that, try copying the folder:?myDiary\lib\gtk-2.0\2.10.0\loaders to wherever GTK was installed to. You can figure this out by typing %GTK_BASEPATH% from Command Prompt. Or better yet, if GTK got installed to C:\Program Files\Common Files\…, re-install GTK to a directory where administrative privileges are not required when writing to, eg. C:\GTK.

If you experience any further issues or can’t resolve this issue, send an email to support@wilmens.net providing your version of Microsoft Windows, the path where GTK was installed to (%GTK_BASEPATH%) and the path where you installed myDiary to.

Problem Solved!

  • Wednesday Sep 24,2008 09:04 PM
  • By wmensah
  • In myDiary

I finally got everything working just the way I want it. Below is a summary of the problem and the solution to it

Problem:

GTK 2.0 Runtime Environment gets installed in 2 different directories based on which version of Windows you’re running. In my case, Vista and XP

In Vista, it was installed to: C:\Program Files (x86)\Common Files\

In XP, it was installed to C:\

As a result the GTK_BASEPATH environment had 2 different values for each operating system – not such a good thing.

Unfortunately for my python application which requires pango modules to run, the pango.modules and gdk-pixbuf.loaders files had paths to the necessary dll files hard-coded in them.

This is a portion of my pango.modules file

# Pango Modules file

# Automatically generated file, do not edit

#

# ModulesPath = C:\GTK\lib\pango\1.6.0\modules

#

“C:\\GTK\\lib\\pango\\1.6.0\\modules\\pango-arabic-fc.dll” ArabicScriptEngineFc PangoEngineShape PangoRenderFc arabic:* nko:*

“C:\\GTK\\lib\\pango\\1.6.0\\modules\\pango-arabic-lang.dll” ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:*

Notice how C:\\GTK has been hard-coded. This created a problem whenever the application was installed and run on a different computer other than mine (on which the hard-coded paths made sense). I suppose the executable file pango-querymodules.exe is supposed to fix this but I had weird results instead. So my solution?….

Solution:

  • Manually go inside these two files: pango.modules and gdk-pixbuf.loaders and replace every instance of GTK’s base path with some string of your choice ( I used <gtk_basepath> for mine).
  • Create a python file to access the two files that has hard-coded paths in them: pango.modules and gdk-pixbuf.loaders and perform a search and replace <gtk_basepath> with the value of the GTK_BASEPATH environment variable. You can do something like:

import os
replacestring = os.environ['GTK_BASEPATH']

where replacestring is a variable that will be used to replace every instance of <gtk_basepath> in both files (watch out for ‘\’ and ‘\\’)

  • Finally create a batch file to execute this python file after installation is complete. You can use the same batch file to delete the python file after that when done because you wont need it anymore.?

My batch file looked like this:

START PYTHON postscript.py

DEL postscript.py

And that’s it, pango.modules and gdk-pixbuf.loaders should now have the correct paths to GTK no matter where it is installed.

I hope this helps someone.

GTK_BASEPATH continued…

  • Tuesday Sep 23,2008 09:45 PM
  • By wmensah
  • In myDiary

So a sweeter approach will be to replace the path to GTK in every file for which this path has been hardcoded (pango.modules and gdk-pixbuf.loaders, in my case) with the GTK_BASEPATH environment variable. How to do this?……simply write a python script to perform a search and replace on whatever the current GTK path in the file is and replace it with the value of GTK_BASEPATH. I haven’t actually tried it but when I do I’ll submit a post stating whether I was successful or not.

The python OS module allows us to determine which operating system the user is currently running so that might be of some help.

GTK for Windows XP/Vista BASEPATH

  • Monday Sep 22,2008 02:30 AM
  • By wmensah
  • In myDiary

Ok, something really weird is going on. Maybe I’m dumb but someone has to explain this to me (so i can quit being dumb). I tried installing GTK 2 Runtime Environment on 2 different operating systems: Windows Vista and XP and got 2 different results which I thought was very strange.

First of all, when installing on XP, the default path was: C:\Program Files\Common Files – what is wrong with that? Nothing – nothing at all but why is it that running the same installer on Vista defaults to C:\GTK? and what happened to that 2.0 directory inside it? That’s some major inconsistency if you’d ask me. Maybe it’s because of how my environment variables are set up.

In XP, the GTK_BASEPATH =?C:\PROGRA~1\COMMON~1\GTK

In Vista, the GTK_BASEPATH = C:\GTK

default value for the environmental variable ‘GTK_BASEPATH’ in Vista 64 bit was set to ‘C:\PROGRA~2\COMMON~1\GTK\2.0′.

I just found a blog via Google search addressing the same issue.

http://dreblen.wordpress.com/2008/08/06/adding-gtk-to-the-windows-path/

and another relevant forum

http://gobby.0×539.de/trac/ticket/292

I still don’t get why there’s a directory ‘C:\GTK\2.0′ in XP but not in the GTK directory in Vista. I’ll try to figure it out later. For now I have created a batch file which kind of fixes the issue:

IF EXIST C:\GTK\2.0 XCOPY C:\GTK\2.0 C:\GTK\ /E /Y

RMDIR C:\GTK\2.0\ /s /q

which simply moves the contents of C:\GTK\2.0 to C:\GTK and removes C:\GTK\2.0

I guess this will do for now till I figure out an alternative method. I know one could be creating a batch file to set the correct GTK_BASEPATH value based on which version of Windows is being run. But that’s just a thought.