TBrowser crashing python when called!

Hi. With a simple setup, I seem to be crashing PyROOT and would appreciate some help on what I’m doing wrong. My machine is an Intel MacBook running Snow Leopard with ROOT version 5.27/02, the Snow Leopard system python 2.6.1, and PyROOT version 6.0.2.

mwoods 2 00:13:47 ~$ cat tbrs_test.py 
from ROOT import TBrowser
TBrowser()
print "I happily ran"
mwoods 3 00:13:52 ~$ python tbrs_test.py
I happily ran

Now the code is edited to add a raw_input()

[code]
mwoods 6 00:14:17 ~$ cat tbrs_test.py
from ROOT import TBrowser
TBrowser()
raw_input()
print "I happily ran"
mwoods 7 00:14:26 ~$ python tbrs_test.py

Error in : BadDrawable (invalid Pixmap or Window parameter) (TGListTree XID: 6291604, XREQ: 53)
TGListTree: 6291604
TGViewPort: 6291587
TGCanvas: 6291586
TGFileBrowser: 6291559

*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

Thread 2 (process 4366):
#0 0x00007fff869e2c92 in wait4 ()
#1 0x00007fff869f723e in system ()
#2 0x000000010110e818 in TUnixSystem::StackTrace ()
#3 0x000000010110c19a in TUnixSystem::DispatchSignals ()
#4
#5 0x00000001040c32f9 in TGWindow::Print ()
#6 0x00000001040361cc in TGCompositeFrame::Print ()
#7 0x000000010345faf3 in RootX11ErrorHandler ()
#8 0x0000000103e23c40 in _XError ()
#9 0x0000000103e25a4c in _XReply ()
#10 0x0000000103e0a367 in XGetGeometry ()
#11 0x0000000103469461 in TGX11::ResizeWindow ()
#12 0x0000000102b92c00 in TCanvas::Resize ()
#13 0x00000001040d4d77 in TRootCanvas::HandleContainerConfigure ()
#14 0x00000001040dab1a in TRootContainer::HandleConfigureNotify ()
#15 0x000000010403187d in TGFrame::HandleEvent ()
#16 0x00000001040037c0 in …


Lots more Lines

==============================================

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00000001040c32f9 in TGWindow::Print ()
#6 0x00000001040361cc in TGCompositeFrame::Print ()
#7 0x000000010345faf3 in RootX11ErrorHandler ()
#8 0x0000000103e23c40 in _XError ()
#9 0x0000000103e25a4c in _XReply ()
#10 0x0000000103e0a367 in XGetGeometry ()
#11 0x0000000103469461 in TGX11::ResizeWindow ()
#12 0x0000000102b92c00 in TCanvas::Resize ()
#13 0x00000001040d4d77 in TRootCanvas::HandleContainerConfigure ()
#14 0x00000001040dab1a in TRootContainer::HandleConfigureNotify ()
#15 0x000000010403187d in TGFrame::HandleEvent ()
#16 0x00000001040037c0 in TGClient::HandleEvent ()
#17 0x00000001040040bb in TGClient::ProcessOneEvent ()
#18 0x000000010400412e in TGClient::HandleInput ()
#19 0x000000010400414d in TGInputHandler::Notify ()
#20 0x000000010110c2bc in TUnixSystem::DispatchOneEvent ()
#21 0x00000001010a6db8 in TSystem::ProcessEvents ()

Terminated
mwoods 8 00:14:38 ~$ exit[/code]

I was looking to write a quick script to load up some root files into an interactive python session to examine them. If I remove the raw_input() and instead use the interactive -i flag when I call python, I get the same error as in the latter example. It seems something about a pause after the TBrowser(), whether that is a raw_input() or an interactive session…

If I start up IPython (or the python shell) and import TBrowser from ROOT and run TBrowser() everything is fine and I get an interactive TBrowser to work with.

Any help towards a work around would be quite welcome. Thanks!

Hi,

not sure where the crash is coming from, but since you actually want to use the browser, you should keep it alive, by taking a reference to it (“b = TBrowser()”). That’ll solve the crash as well, of course.

Cheers,
Wim

Thanks Wim!