Weblog

published Nov 03, 2021, last modified Nov 04, 2021

Introduction to pywinauto

published Jul 04, 2006, last modified May 18, 2007

by Mark McMahon

He's a localization software engineer, uses python for interfacing with legacy applications, for tools, and automating stuff. Python is unfortunately not a standard in his company.

What is pywinauto?

It automates clicking in Windows. E.g. open up Microsoft Paint, create a new file, paint something. Hard to write tests for.

If you set the delays between commands too short, the right window may not have come up yet so you get an error. Be aware of that.

It was first written in C to analyze localized dialog boxes for GUI bugs (1998). Then moved to C++ (2000), then python (2005). Conversion to C++ took two years, to python two or three months. :)

Example:

from pywinauto.application import Application

app = Application.Start("Notepad")

app.Notepad.Edit

app.Notepad.Edit.TypeKeys("Hello World")

WinSpy or Winspector help you to figure out which classes to use, e.g.

canvas = app.untitledPaint.Afx1000000008

Pywinauto is all dynamic:

  • no dialog declaration needed
  • fuzzy matching of titles (resistance to software changes)

Easy to understand.

It could use a script recorder, integration with test tools and a merciless refactoring.

Microsoft Office is done very differently, uses other controls. You can't use pywinauto for that.

See Mark's blog

Subversioned system configuration

published Jul 04, 2006, last modified May 18, 2007

by Holger Krekel from merlinux

Linux distros need configuration and customisation. People want to modify text config files. Some changes need reviews to prevent bad things from happening. Without tool support this is fragile. Problems are then hard to track.

You can version the /etc directory with subversion or the like. But permissions and ownerships is hard to do right there. They can be different from system to system. This is intrusive. You don't want that many versioned directories.

vadm gives you indirect versioning. vadm add /etc/passwd This maps to-be-versioned files into user-specific working copies. It delegates to an underlying versioning system. It gives bidirectional transform of ownership and permission info. History and diffs are available.

vadm: using it

  • prerequisites: svn installation, sudo rights for executing user, and a repository
  • vadm init file:///sysrepo/mysystem
  • vadm add/remove/commit/diff/log path/to/configfile
  • Start using it just like subversion

Setup notifications:

  • Install a post-commit hook into subversion repo to signal admins of changes.
  • daily cronjob may commit any pending changes

We use it to control some 20 systems now. Daily auto-committing has proven to be valuable. It signals changes to others who can then review your changes. You can find out who edited particular lines.

Versioning clusters

  • this is future work
  • versioning multiple similar machines:
    • distinguish between local and global (cluster-wide) changes
    • allow groups of systems (postfix systems, subversion systems)
    • per system would take preference
  • a cluster vadm should only require ssh + local svn config
  • vadm is slow now
  • don't require a server-side daemon other than sshd?

Suggested semantics

  • a URL defines a group of versioned files.
  • each system has a stack of multiple such urls
  • url marked manual-update or auto-update

Other considerations:

  • versioning package installation information. An update of the apache package probably has a new config file. Do this in the same commit.
  • speed up versioning of hundreds of system files
  • plug in other versioning systems. Subversion is best supported now.

vadm future:

  • release planned in 2006, under GPL
  • development happens on a demand basis
  • training/support possible

Use the source

Integrating Twisted with existing frameworks

published Jul 04, 2006, last modified May 18, 2007

by Mr. Moshe Zadka (B-hive Networks)

Joe Developer thinks Twisted is overkill, so he tries to code his own server. But it can only serve one client at a time. But Twisted is overkill, right, so he tries some more clever ideas, with forkingTCPServer. Still doesn't work. So he finally tries out Twisted.

Twisted is:

  • high Level: for basic things you need just a few lines. It makes the common case easy.
  • with good abstractions. Try defer.Deferred() for processing values that don't exist, which is actually handy. That is a structured way for handling errors.

His Twisted program uses one thread at this point, which is not good when every line received takes long to process. To solve that you can use the process protocol. Or deferred.deferToThread()

You could use the standard python socket library. But Twisted was written because this is hard to use.

eXtremeManagement of Projects in Plone

published Jul 04, 2006, last modified May 18, 2007

by Maurits van Rees from Zest Software. Eh, yes, that's me. :)

Okay, so I gave a talk myself on Europython. My brother wrote about it. You can get the slides at the Zest Software site. Click the red button next to the printer to get a Powerpoint-like presentation.

Holger Krekel thought the examples (adding for example Stories and Tasks to the live site) took too long. He would have preferred to see some more content like that already prepared. I tried that at the Zest office the week before and they told me to do more examples, so the truth is probably somewhere in the middle. :)

Someone else wondered if anyone at Zest Software could talk German. In that case he would probably want to hear this talk in I think the German Zope User Group (dzug). Also vielleicht gehe ich mal nach Deutschland!

Europython 2006 overview

published Jul 04, 2006, last modified May 18, 2007

I am at the Europython 2006 conference at the CERN in Geneva. I am holding a talk myself Monday. I will be writing about talks I visited here. Hm, I thought about making this an overview page with links to all the talks, but I think my main page on July 2006 should work fine actually. And as usual: see my brother's weblog