Creating a canvas in PyROOT on a Windows machine hangs

I use ROOT 5.26 with ActiveState Python 2.5.4 on Windows XP.

Any code that creates a canvas hangs: the canvas is blank with an hour-glass and the python session is not responding. The python process needs to be killed manually.

The simplest way to reproduce it is attached. I tried many more variations (with explicit creation of a TCanvas object, etc.) and they all fail in a similar manner.

By the way - there is no such problem on any Linux: I tried CERN lxplus (32-bit), lxplus (64-bit) and my private Fedora 12 box, after building ROOT locally with Python 2.6. All work perfectly.
draw.py (234 Bytes)

Hi,

looks like the known issue from savannah.cern.ch/bugs/?59945

Cheers, Axel.

So until further notice there is no PyROOT on Windows? That is a real shame. Is there any chance that later Python implementations (2.6, 3.1) solve the problem?

Hi,

the issue was introduced in changes to TWinNTSystem, so there is no expectation that later versions of python are going to make a difference …

Sorry,
Wim

Hi,

To be more precise, the event processing model (between TWinNTSystem and TGWin32) has been modified for several reasons (thread safety being one of them) and doesn’t allow to process events from another thread than the main one. Since Python start a separate thread to process events, this cannot work. We are actually investigating to find a solution, without having to introduce weakness or side effects in the regular Win32 (without Python) model.

Cheers, Bertrand.

Bertrand,

well, I still don’t think that the dual threads (or re-entrance for that matter) is the real problem. Rather it should be solvable by not updating the console from the GUI thread (seems to be the main difference between WinNT and other platforms, and seems to be the change that caused the problem).

I’ve been trying again and this seemed to work, where a solution might be a separate updater for python (or any other application that does not need console updates).

However, I got stuck once more when trying to build on Windows: I spent the last 4 hours trying to get to link, but all I get is that ‘–1’ is not a valid linker option or that ‘/IGNORE:4001’ is not a valid linker option. Furthermore, trying to disable certain options such as afterimage (which doesn’t build on my box) gets ignored by configure.

I don’t think that this problem will ever be fixed until I get help from a user/developer who is able to build on Windows and willing to test with python.

Sorry,
Wim

Hi Wim,

Don’t worry, I’m working on it…
And I don’t understand the problems you have on Windows.
Could you make sure that you’re really using link.exe from MSVC++ and not the one from cygwin? (delete or rename cygwin/bin/link.exe).
Typing “link” should give something like:

Cheers, Bertrand.

Bertrand,

unfortunately, I need to do part of the compilation under cygwin, as MSVC doesn’t seem to get the dependencies right: from a clean install, it always fails with Reflex linking not being able to find lib/libCintex.lib, whereas cygwin will properly build that lib before trying Reflex. In addition, configure doesn’t work for me under MSVC (it is never able to find python using absolute paths; I was able to move the installation so that I could use relative paths, which did work, but is fugly). Finally, MSVC always rebuilds more than seems necessary, which unduly lengthens the build/test cycle.

In the end, after another 5 hours, I’ve seem to have stumbled upon a repeatable recipe, going back and forth between cygwin and MSVC, with then only one final manual step …

Looking forward to see the solution …

Cheers,
Wim

Dear experts
I was wondering if anyone managed to solve the problem with pyroot crashing with TCanvas? I’m having exaclty the same problem. I use python 2.5.4 with root 5.22.00, both 32 bit version on 64 vista. I’m using the latest version VC (updated automatically) I think VC is 64 bit, but I’m not sure if this could be the source of problem. import ROOT and all other standard commands like opening root files and initialising histograms work, except creating canvas. Have anyone tried to get pyroot work on 64 platform? if so what is recipe?

Thanks
Irakli

They fixed it in ROOT version 5.26.00b.