Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

Monday, April 30, 2007

Python: unknown Encoding

I nearly pulled my hair out while trying to find the solution for this error:

LookupError: unknown encoding: cp720

FROM this following code fragment:

print "Name: ", objItem.Name

It was obvious, since my Windows System is an Arabic locale, with English default text, that I was surly to have some kind of problem.

I managed to find a lot of information regarding codecs, encoding, local, setlocale, etc. However, I managed to get it solved by using the str() function!

print "Name: ", str(objItem.Name)

Voi la..

Monday, April 23, 2007

Revelation

"The uglier the code, the prettier the program."
- Transparently

Saturday, April 14, 2007

Publishing My app: Part II

I've cleaned up most of my application. Created a new batch file to test the path of the VBS files and added an argument checked so all I'd need to do is type "runmod.bat 1" and end up running the Defragmentation check on all of our servers.

It was important to be delicate about this issue. I wouldn't want to run it by mistake, and risk stressing the servers during working hours. I created 5 schedules (1 for each module) to run during the early AM.

One of the Modules is a Windows Patch Version check. It transforms an exported XML from LANGuard Security Scanner to a generic XML file. I then have a small script called create_xsl.vbs which reads variables from a config file and creates an XSL file with the relevant information using a template. Sounds pretty tiresome but it works great since now I can write a VBS module file, a config file.. and easily add it to the HTA application without worrying about encoding or re-coding any of the core application.

Related Post: Publishing My App Part I