python - Python3 / SWIG and output streams -


i using swig generated python wrappers gdcm (comes gdcm.py).

i running following python3 script.

import gdcm import sys  filename="path_to_data/gdcm_test.dcm"  r = gdcm.reader() r.setfilename(filename) r.read()  f=r.getfile() ds = f.getdataset()  csa_t1 = gdcm.csaheader()  t1 = csa_t1.getcsaimageheaderinfotag()  csa_t1.loadfromdataelement(ds.getdataelement( t1)) csa_t1.print(sys.stdout) 

the relevant snippet gdcmswig.py file (with function wraps print) below.

def print(self, os: 'std::ostream &') -> "void":     """     void     gdcm::csaheader::print(std::ostream &os) const      print csaheader (use if format == sv10 or nomagic)      """     return _gdcmswig.csaheader_print(self, os) 

the problem appears on last line of script. call print(sys.stdout).

typeerror: in method 'csaheader_print', argument 2 of type 'std::ostream &' 

the problem, think, python’s sys.stdout not actual output file handle, wraps handle. best way solve this? in advance.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -