Repository: rootpy/rootpy

Issue:
many 'no dictionary for class' warnings using get_file()
Using get_file() results in many 'no dictionary for class' warnings:

``` python
>>> from rootpy.testdata import get_file
>>> get_file()
INFO:rootpy.logger] | No default log handler configured. See `logging` module |
INFO:rootpy.logger] \    To suppress: 'rootpy.log.basic_config_colorized()'   /
WARNING:ROOT.TClass.TClass] no dictionary for class TH1F is available
WARNING:ROOT.TClass.TClass] no dictionary for class TH1 is available
WARNING:ROOT.TClass.TClass] no dictionary for class TAxis is available
WARNING:ROOT.TClass.TClass] no dictionary for class TH2F is available
WARNING:ROOT.TClass.TClass] no dictionary for class TH2 is available
WARNING:ROOT.TClass.TClass] no dictionary for class TH3F is available
WARNING:ROOT.TClass.TClass] no dictionary for class TH3 is available
WARNING:ROOT.TClass.TClass] no dictionary for class TGraphAsymmErrors is available
WARNING:ROOT.TClass.TClass] no dictionary for class TGraph is available
WARNING:ROOT.TClass.TClass] no dictionary for class TGraphErrors is available
WARNING:ROOT.TClass.TClass] no dictionary for class TGraph2D is available
File('/home/sschmitt/.local/lib/python2.7/site-packages/rootpy-dev-py2.7.egg/rootpy/testdata/test_file.root')
```

Everything works nonetheless.



Discussion:
Platform? ROOT version? Can you reproduce on lxplus or give us more information about your setup? This isn't the behaviour I see.

It looks a lot like a broken root installation to me.

Strange, I can confirm the same warnings on my system.

My bad, it must have been introduced by a recent commit, I now see it too.

Stack trace:

```
$ python -c "from rootpy import log; log['/ROOT'].showstack(); from rootpy.testdata import get_file; get_file()"
INFO:rootpy.logger] | No default log handler configured. See `logging` module |
INFO:rootpy.logger] \    To suppress: 'rootpy.log.basic_config_colorized()'   /
WARNING:ROOT.TClass.TClass] no dictionary for class TH1F is available
WARNING:stack] File "<string>", line 1, in <module>
WARNING:stack] File "rootpy/testdata/__init__.py", line 16, in get_file
WARNING:stack]   return File(filepath, 'read')
WARNING:stack] File "rootpy/io/file.py", line 186, in __init__
WARNING:stack]   super(File, self).__init__(name, *args, **kwargs)
```

Looks like we need to trigger finalSetup, @ndawe.

`python -c "from rootpy import log; log['/ROOT'].showstack(); from rootpy.testdata import get_file; import ROOT as R; R.kTRUE; get_file()"`


Resolving patch:
diff --git a/rootpy/io/file.py b/rootpy/io/file.py
--- a/rootpy/io/file.py
+++ b/rootpy/io/file.py
@@ -183,6 +183,8 @@ class File(_DirectoryBase, QROOT.TFile):
     """
     def __init__(self, name, *args, **kwargs):
 
+        # trigger finalSetup
+        ROOT.kTRUE
         super(File, self).__init__(name, *args, **kwargs)
         self._path = self.GetName()
         self._parent = self
@@ -218,7 +220,7 @@ class TemporaryFile(File, QROOT.TFile):
     def __init__(self, *args, **kwargs):
 
         self.__fd, self.__tmp_path = tempfile.mkstemp(*args, **kwargs)
-        File.__init__(self, self.__tmp_path, 'recreate')
+        super(TemporaryFile, self).__init__(self.__tmp_path, 'recreate')
 
     def Close(self):
 


Test patch: