<div dir="ltr"><div class="gmail_default" style="font-size:large">I had a look this evening... it was a bit fiddly, but I've converted all the Python write and read functions to use the C++ IO functions, and have moved more .gz filename detection into the C++. So it works now. Needs some improvements to converter script argument parsing, but I think should work now for your purposes.</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Andy</div><div class="gmail_default" style="font-size:large"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 April 2018 at 11:38, 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"><div style="word-wrap:break-word">Thanks Andy,<div><br></div><div>I'll give it a try.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Louie</div></font></span><div><div class="h5"><div><br><div><blockquote type="cite"><div>On 25 Apr 2018, at 11:33, Andy Buckley <<a href="mailto:andy.buckley@cern.ch" target="_blank">andy.buckley@cern.ch</a>> wrote:</div><br class="m_3425033642079596882Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><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-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);float:none;display:inline">format, and is implemented in src/<a href="http://readeryoda.cc/" target="_blank">ReaderYODA.cc</a><span class="m_3425033642079596882Apple-converted-space"> </span>and <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:large;font-style: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);float:none;display:inline">src/<a href="http://writeryoda.cc/" target="_blank">Writ<wbr>erYODA.cc</a></span><span class="m_3425033642079596882Apple-converted-space"> </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" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On 23 April 2018 at 13:59, Corpe, Louie<span class="m_3425033642079596882Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:l.corpe@ucl.ac.uk" target="_blank">l.corpe@ucl.ac.uk</a>></span><span class="m_3425033642079596882Apple-converted-space"> </span>wrot<wbr>e:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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/pub<wbr>lic/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.MEWei<wbr>ght.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_DSIDx<wbr>xx.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/sc<wbr>ratch/rivet/YODA-1.7.0/pyext/<wbr>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" target="_blank">Rivet@projects.hepforge.org</a><br><a href="https://www.hepforge.org/lists/listinfo/rivet" rel="noreferrer" target="_blank">https://www.hepforge.org/lists<wbr>/listinfo/rivet</a><br></blockquote></div><br><br clear="all"><div><br></div>--<span class="m_3425033642079596882Apple-converted-space"> </span><br><div class="m_3425033642079596882gmail_signature" data-smartmail="gmail_signature">Dr Andy Buckley, Lecturer / Royal Society University Research Fellow<br>Particle Physics Expt Group, University of Glasgow</div></div></div></blockquote></div><br></div></div></div></div></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>