Loading classes from multiple Python files

From: Marius Bjørnstad <paul.bjoernstad_at_hep.manchester.ac.uk>
Date: Mon, 14 Mar 2011 15:58:00 +0100


Hi fellow ROOTers,

I'm using ROOT 5.28/00a. I am loading classes from several ROOT macros. The functions seem to get mixed up. I created this simple test case, with two python files, each containing a class:

classA.py:
class A:
  def hop():
    print "hop"

classB.py:
class B:
  def duck():
    print "quack"

I then get:

root [0] TPython::LoadMacro("classA.py")
root [1] TPython::LoadMacro("classB.py")
root [2] A a;
root [3] a.hop()

TypeError: unbound method duck() must be called with B instance as first argument (got A instance instead)
TypeError: expected string or Unicode object, NoneType found (class TPyReturn)191963200

This looks like a bug, but I might be doing something wrong. Any ideas?

Thanks,
Marius Received on Mon Mar 14 2011 - 15:58:06 CET

This archive was generated by hypermail 2.2.0 : Tue Mar 22 2011 - 23:50:01 CET