My Python & co. stuff

Archive for the ‘win32’ Category

Qt Creator from Qt SDK 1.1.3 was very slow for me.

My setup? VAIO equipped with i5 + 8 GB RAM + 500GB of Seagate Momentus XT.


  • Qt Creator started up in about minute. During that time, it didn’t utilize any of CPU (0-1%) and steadily grown in memory from about 50MB up to 80MB
  • typing anything in Options search box caused the whole program to hang
  • clicking “Analyzer” or “Version control systems” in options… yes, you guessed it. Hang.

The whole situation looked like a single false click – and I am doomed to wait for around 30 seconds until it starts working again.

Antivirus? Turned off. Didn’t help.

Solution? Yes, I found it. This is my path:

C:\Users\dotz\Desktop>echo %PATH%
C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\ActiveState Komodo IDE 6\;C:\Program Files (x86)\ActiveState Komodo Edit 6\;C:\GTK\bin;C:\Program Files (x86)\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Calibre2\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Bazaar;C:\Program Files (x86)\VisualSVN\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Nmap;c:\python27;c:\python27\scripts;c:\gnuwin32\bin;c:\Program Files (x86)\PuTTY

As you can see, I have GnuWin32 in it and a few version control systems (TortoiseSVN, for example). I have no idea which caused Qt Creator to lag. Instead, I created a simple batch file to start it up, like this:

@echo off
set PATH=c:\windows;c:\windows\system32
start c:\qtsdk\QtCreator\bin\qtcreator.exe

Qt Creator starts quickly and works fast.

Are you affected by this bug too? You can comment on the bug report page I created.

Update: Solved. The offending path entry?
set PATH=\

Python has it’s own logging. Twisted has it’s own logging. Unfortunatley, none of them have a convinient way to log to underlying operating system’s facilities (which is, syslog or Windows Event Log in my case). So, I had to wrote one myself. Here you go – this is MultiLog:

class MultiLog(object):
class MultiLog(object): """ Multiplatform logging component. (C) 2009 FHU KAGAMI <> Distributed under the terms of MIT License """ def __init__(self, appname, interactive = None): self.hostname = socket.gethostname() self.appname = appname self.interactive = interactive if self.interactive is None: self.interactive = '--interactive' in sys.argv = os.getpid() fun = '_init_log_' + sys.platform getattr(self, fun)() def log(self, msg): if type(msg)==unicode: msg = msg.encode('utf8') fun = '_log_' + sys.platform return getattr(self, fun)(msg) __call__ = log def _log_interactive(self, msg): if self.interactive: msg = time.ctime() + ": " + self.hostname + " " + self.appname + "[" + str( + "]: " + msg sys.stderr.write(msg) sys.stderr.write('\n') sys.stderr.flush() def _init_log_unix(self): from syslog import openlog openlog(self.appname + "[" + str( + "]") def _log_unix(self, msg): from syslog import syslog syslog(msg) self._log_interactive(msg) _init_log_linux2 = _init_log_unix _log_linux2 = _log_unix def _init_log_win32(self): import win32evtlog import win32con self._win32_type = win32con.EVENTLOG_INFORMATION_TYPE self._win32_log = win32evtlog.OpenEventLog(None, self.appname) def _log_win32(self, msg): import win32evtlog win32evtlog.ReportEvent(self._win32_log, self._win32_type, 0, 0, None, (msg, 'PID: %s' %, None) self._log_interactive(msg) if __name__ == "__main__": log = MultiLog('my application') log('this is a test')

On Ubuntu, look for /var/log/user.log. On Windows, run mmc.exe and open eventwvr – look for Application Logs.