Hi,
I am using Windows 7. Everything I put here is working on linux with the same python and root version. I just need to run it on Windows.
I have installed:
- root 5.34/34.
- python 2.7
- rootpy
It imports ROOT correctly, however, then I try to run my code:
[code]import astropy
import photutils
import ROOT
from rootpy.tree import Tree, TreeModel
from rootpy.tree import IntCol, FloatCol, FloatArrayCol, CharCol, CharArrayCol
from rootpy.io import root_open
from random import gauss, choice, sample
from string import letters
class Event(TreeModel):
idd = IntCol() # event idd in a run
ipeaks = IntCol() # number of peaks detected on one photo
ip = IntCol() # number of a peak in a given photo
xpos = FloatCol()
ypos = FloatCol()
integral = FloatCol() # peak integral
area = FloatCol() # area of the peak in pixel**2
max_value = FloatCol()
covar_sigx2 = FloatCol()
covar_sigy2 = FloatCol()
def creat_file(name):
print ("— root file is created —")
f = root_open(name,‘create’)
tree = Tree(“tree1”, model=Event)
tree.write()
f.close()
return;
TEST:
creat_file(“rfiles/test.root”)[/code]
I have the following error and warning:
WARNING:rootpy.logger.magic:Couldn’t find SetErrorHandler. Please submit a rootpy bug report.
— root file is created —
Traceback (most recent call last):
File “start.py”, line 51, in
creat_file(“rfiles/test.root”)
File “start.py”, line 33, in creat_file
f = root_open(name,‘create’)
File “C:\Users\sophi\AppData\Roaming\Python\Python27\site-packages\rootpy\io\f
ile.py”, line 137, in root_open
prev_dir = ROOT.gDirectory.func()
File “C:\Users\sophi\AppData\Roaming\Python\Python27\site-packages\rootpy\ROOT
.py”, line 81, in gSomething
glob = getattr(ROOT, name)
File “C:\bin\root_v5.34.34\bin\ROOT.py”, line 455, in __getattr1
self._finalSetup()
File “C:\Users\sophi\AppData\Roaming\Python\Python27\site-packages\rootpy\defa
ults.py”, line 157, in wrapFinalSetup
configure_defaults()
File “C:\Users\sophi\AppData\Roaming\Python\Python27\site-packages\rootpy\defa
ults.py”, line 91, in configure_defaults
this_dll = C.CDLL(None)
File "C:\Users\sophi\Anaconda2\lib\ctypes_init.py", line 362, in init
self._handle = _dlopen(self._name, mode)
TypeError: expected string or Unicode object, NoneType found
Actually, I have that worning every time I import something from rootpy for the first time. I also can not open a root file and save it.
Any ideas?
Thank you in advance,
Basia