<div dir="ltr"><div class="gmail_default" style="font-size:large">I dug a bit more: it works from C++ but not from Python. Funny, I could have sworn that I had both working, but apparently not. It also doesn't work for gz output at the Python level, apparently: yoda2yoda test.yoda test.yoda.gz does not work, but it should.</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default"><font size="4">The Python interface to the YODA IO functions is in pyext/yoda/include/IO.pyx. It does have to play some games to convert the Pythonic view of files to the C++ stream one, and maybe this is where it's going wrong. It's certainly where the complaint about the ascii encoding is coming from. Could you take a look there and see if you can persuade it to do the right thing?</font></div><div class="gmail_default"><font size="4"><br></font></div><div class="gmail_default"><font size="4">The zipped IO itself is only supported for the YODA <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:large;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">format, and is implemented in src/ReaderYODA.cc and <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:large;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">src/WriterYODA.cc</span> -- it should be completely automatic and you shouldn't have to touch this code, but it might help for understanding how to interface it to the Python.</span></font><br></div><div class="gmail_default"><font size="4"><br></font></div><div class="gmail_default"><font size="4">Andy</font></div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 April 2018 at 13:59, Corpe, Louie <span dir="ltr"><<a href="mailto:l.corpe@ucl.ac.uk" target="_blank">l.corpe@ucl.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Riveters,<br>
<br>
<br>
I'm trying to use the zipped i/o functionality introduced in Rivet 2.6.0 / Yoda 1.7.0.<br>
I can't seem to get it working: is there an example of how to do this somewhere?<br>
<br>
I've included a minimal example [1]. Please let me know what I'm doing wrong!<br>
The files I used in [1] can be found on my public on lxplus: /afs/<a href="http://cern.ch/user/l/lcorpe/public/RivetZippedIO/examples/" rel="noreferrer" target="_blank">cern.ch/user/l/lcorpe/<wbr>public/RivetZippedIO/examples/</a><br>
<br>
All the best and thanks in advance !<br>
<br>
<br>
Louie<br>
<br>
<br>
[1]<br>
[lcorpe@lxplus005 scratch]$ gzip -c out1028_DSIDxxx.MEWeight.yoda > examples/out1028_DSIDxxx.<wbr>MEWeight.yoda.gz<br>
[lcorpe@lxplus005 scratch]$ python<br>
Python 2.7.5 (default, Aug 4 2017, 00:39:18)<br>
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import yoda as y<br>
>>> a= y.read("examples/out1028_<wbr>DSIDxxx.MEWeight.yoda.gz")<br>
Traceback (most recent call last):<br>
File "<stdin>", line 1, in <module><br>
File "yoda/include/IO.pyx", line 107, in yoda.core.read (/afs/<a href="http://cern.ch/user/l/lcorpe/scratch/rivet/YODA-1.7.0/pyext/yoda/core.cpp:85809" rel="noreferrer" target="_blank">cern.ch/user/l/lcorpe/<wbr>scratch/rivet/YODA-1.7.0/<wbr>pyext/yoda/core.cpp:85809</a>)<br>
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: ordinal not in range(128)<br>
>>><br>______________________________<wbr>_________________<br>
Rivet mailing list<br>
<a href="mailto:Rivet@projects.hepforge.org">Rivet@projects.hepforge.org</a><br>
<a href="https://www.hepforge.org/lists/listinfo/rivet" rel="noreferrer" target="_blank">https://www.hepforge.org/<wbr>lists/listinfo/rivet</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Dr Andy Buckley, Lecturer / Royal Society University Research Fellow<br>Particle Physics Expt Group, University of Glasgow<br></div>
</div>