Tuesday, July 13, 2010

So I wanted to use Pystemmer (http://snowball.tartarus.org/wrappers/PyStemmer-1.1.0.tar.gz not http://sourceforge.net/projects/pystemmer/ which seems to be out of date), but there is no included Visual Studio makefile or solution.

So what to do?

Below are the steps that I find work reasonably well (hopefully documented in a way that will allow other people to do the same for whatever library they are working with).

Note - I assume the following:

The code as provided will compile with Visual C (if Visual C cannot compile it - then your job is way harder!)

No extra tools (autoconf, etc) are required

So the steps are:

Ensure directory with Python.h is in the %include% directories (menu item: Tools -> Options, Projects and Solutions -> VC++ Directories, Show directories for -> Include Files)

Ensure directory with Python.lib is in the %lib% directories (as as steps for Include files - just select Library Files instead at the end)

The reason for this is that a symbol is defined in 2 source files, for PyStemmer this was because there is both libstemmer_utf8.c and libstemmer.c in the codebase which define the same symbols. The fix was to remove one from the project

"Cannot open include file"

.\src\Stemmer.c(30) : fatal error C1083: Cannot open include file: 'libstemmer.h': No such file or directory

This is a simple fix - find where the include file is and add it to the include path Project Properties dialog, C/C++ -> General -> Additional Include Directories

Sunday, April 18, 2010

My talk is titled "Writing Application Plugins in Python". I aim to show how Python can be used to implement plugin functionality for applications that never even heard of Python.

The idea being, that if you write a small amount of shim code (using Pyrex/Cython to make it really easy) then you can pass most of the work off to Python. I work on Windows, and my examples will be on that OS, but very little of what I present will be specific to Windows.

I am still searching around for a good Open Source application with a reasonably simple API/SDK that I can demonstrate with. Leave a comment if you have a suggestion. But the majority of the talk will be generic to any application giving introductions to the various tools and modules used.

If you are in or around Singapoare in June - or feel like seeing South East Asia - then drop by :)

I have been working on pywinauto for about 4 and a half years now and its not really moving in any direction. I make small tweaks here and there and make releases from time to time - but nothing major.

This was the first open source project that I released and I think maybe I was a little over-enthusiastic :). I had hoped that I would be using it myself, I also wished it to be functional and easy enough thatthat it could replace expensive commercial software with similar functionality (but with their own annoying languages). But I am no longer working with said software and my main focus went to other things.

I believe now that pywinauto should be split. There is at least 1 small library (and probobaly more) that should be freed from the overall project.

Get information from windows controls (Maybe of the questions on the pywinauto list is how to get the values from text boxes, etc.)

A library for automating Windows, not an auotmation framework/language - a library. Meaning that it is up to the user to delay between clicks for windows to open/close. It is up to the user how they want to select controls.

SendKeysCtypes (I re-wrote Python SendKeys so that it would support Unicode and not need to be compiled (uses Ctypes). This is more or less ready to release - I just haven't gotten around to doing that :(. (if you need it - grab it from Pywinauto SVN)

pywinauto - which would use these previous components but would be much smaller itself, it would work as it does now, trying to help the user as much as possible in not having to worry about timing issues.

Seeing as it turned out that *I* don't really need an automation library/toolkit - it would be great to get some help with some of this work.

Other directions I am thinking of are providing modules so that pywinauto (or the gui automation libarary) can work as an almost direct replacement of things like AutoHotkey or AutoIT or use a similar API as LDTP.

I also need to fix the Pywinauto web presence - which is amazingly scattered - but this post is already long enough.

Sunday, March 07, 2010

I was expecting function to be not so hard (just another way ofrunning a few steps) but it took a little bit of time all the same.

I got it implemented (though no tests for it yet) and it seems OK, Iwill know better how it works when I get around to using it (hopefullyin the next week). Weekends for the tool and weekdays for using thetool in production :)

With this addition I think the language definition is more or lesscomplete I think. I can imagine tweaking it a bit, fixing bugs etc,but I don't expect to implement many other language constructs.

One of the next things that I am planning to implement is a simpledebugger (step through statements, print variable value, maybe changevariable values, etc). I was expecting this to be a fairly majorundertaking but again Python and it's community come to the rescue.Right on cue

Tuesday, March 02, 2010

I created it as something that I could use at work. We have many tasksthat require adhoc automations which may have different people runningthem. These automations may not have a very long life so it oftendoesn't make sense to write it up as Python/Perl script. This work isdone on Windows machines so not many of us (me included) do not have alot of experience with shell scripting. Even if we did - shellscripting wouldn't necessarily be the ideal candidate.

So it was designed as a batch file replacement with some improvements:Some requirements I had while making this:

output from commands can be assigned to variables

it needs to be just as easy to call external applications as a batch file

all actions should be logged

the return value of everything should be checked (and stop the script on error!)

it should be prettier than a batch file

I have not tested this on any *nix style machine yet - but believe itshould work (meaning that it probably won't work at first - but I amhoping that minimal changes will make it work)