I can't seem to get the SDDS Python Demo function to work. I'm diving into the source, but I'm new to the Python C API, so it's slow. So far I've traced the problem to sddsdata.SetParameter(x.index,page,value) where value is a string. Whenever I ask that function to return a value it gives me this error. E.g., if I'm storing the result to a variable, or if I'm comparing it as the Python does in the sdds.save function from "import sdds". I copied the demo and save functions into my own script. When it gets to the sddsdata.SetParameter part, it errors out. I'm running iPython. So it returns and leaves things as it was when it was running. If I try to execute just the sddsdata.SetParameter command, it seems to work. Ipython shows a "1L" as the result. But if I say test=sddsdata.SetParameter(..., same error. If I compare it, same error. If I print it, same error. I have no idea what's going on, but it seems to have an issue with returning a value...
Maybe I just don't try to set parameters that have text instead of values... But it's weird that your demo function doesn't even work, you guys might want to fix that...
Joel
Code: Select all
In [1]: import sdds
In [2]: sdds.dem
sdds.demo sdds.demo2
In [2]: sdds.demo('output.sdds')
/u/pl/joelfred/opt/lib/python2.7/site-packages/sdds/sdds.py:170: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
if sddsdata.SetParameter(self.index, i, self.parameterData[i][page]) != 1:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/afs/slac.stanford.edu/u/pl/joelfred/SDDSTOOLS/<ipython-input-2-9501aeffffb1> in <module>()
----> 1 sdds.demo('output.sdds')
/u/pl/joelfred/opt/lib/python2.7/site-packages/sdds/sdds.pyc in demo(output)
311 ["","","","",x.SDDS_STRING,0],
312 ["","","","",x.SDDS_CHARACTER,0]]
--> 313 x.save(output)
314 del x
315
/u/pl/joelfred/opt/lib/python2.7/site-packages/sdds/sdds.pyc in save(self, output)
168 sddsdata.PrintErrors(self.SDDS_EXIT_PrintErrors)
169 for i in range(numberOfParameters):
--> 170 if sddsdata.SetParameter(self.index, i, self.parameterData[i][page]) != 1:
171 sddsdata.PrintErrors(self.SDDS_EXIT_PrintErrors)
172 for i in range(numberOfColumns):
TypeError: an integer is required