Hi, all-- I've notice that trailing comments are not longer ignored when parsing parameter files. I have a parameter in many of my parameter files that documents itself, as in WriteBoundary = 0 //1=already written, 2=start writing which recently started causing the parameter file to parse. Is this an easy thing to fix in yt, or was this change done intentionally for a broader reason, and I should write a sed script to pull this out? I wouldn't bother asking if it weren't in an enormous number of files. Thanks, d. -- Sent from my computer.
Sorry, I forgot to provide the failure info:
File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py",
line 655, in __init__
StaticOutput.__init__(self, filename, data_style, file_style=file_style)
File "/Users/dccollins/local/src/yt-hg/yt/data_objects/static_output.py",
line 86, in __init__
self._parse_parameter_file()
File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py",
line 745, in _parse_parameter_file
param, vals = (i.strip() for i in line.split("="))
ValueError: too many values to unpack
and "line" is
WriteBoundary = 0 //1=already written, 2=start writing
Previously I was using changeset 9b4ff0766c9c (which may be quite
old), and I'm on 6267774e2f34 presently.
d.
On Wed, Oct 26, 2011 at 9:11 AM, david collins
Hi, all--
I've notice that trailing comments are not longer ignored when parsing parameter files. I have a parameter in many of my parameter files that documents itself, as in
WriteBoundary = 0 //1=already written, 2=start writing
which recently started causing the parameter file to parse. Is this an easy thing to fix in yt, or was this change done intentionally for a broader reason, and I should write a sed script to pull this out? I wouldn't bother asking if it weren't in an enormous number of files.
Thanks, d.
-- Sent from my computer.
-- Sent from my computer.
Hi David,
The change to parameter file parsing was discussed here:
http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-August/001486...
(where I ask for people to test)
and here:
http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-August/001501...
The reason that it changed was an effort to pull all of the parameters
in. The assumption was that the Enzo parameter files read by yt would
almost always be written by Enzo itself and utilize a comment
delimiter that Enzo uses ("#") at the start of the line. The usage of
"//" at the end of a line in a parameter file written by Enzo is not
currently supported. My suggestion would be to look into the code I
mention as changed in the emails and see if you can come up with an
elegant way of getting around the comments you use. However, I would
prefer -- since I think you're the only person who has those comments
written by Enzo in his source files -- that the change be minimally
invasive and not change behavior for anyone else.
Once you have something sketched up, issue a pull request on BitBucket
and we can review it. Thanks,
Matt
On Wed, Oct 26, 2011 at 11:25 AM, david collins
Sorry, I forgot to provide the failure info:
File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py", line 655, in __init__ StaticOutput.__init__(self, filename, data_style, file_style=file_style) File "/Users/dccollins/local/src/yt-hg/yt/data_objects/static_output.py", line 86, in __init__ self._parse_parameter_file() File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py", line 745, in _parse_parameter_file param, vals = (i.strip() for i in line.split("=")) ValueError: too many values to unpack
and "line" is
WriteBoundary = 0 //1=already written, 2=start writing
Previously I was using changeset 9b4ff0766c9c (which may be quite old), and I'm on 6267774e2f34 presently.
d.
On Wed, Oct 26, 2011 at 9:11 AM, david collins
wrote: Hi, all--
I've notice that trailing comments are not longer ignored when parsing parameter files. I have a parameter in many of my parameter files that documents itself, as in
WriteBoundary = 0 //1=already written, 2=start writing
which recently started causing the parameter file to parse. Is this an easy thing to fix in yt, or was this change done intentionally for a broader reason, and I should write a sed script to pull this out? I wouldn't bother asking if it weren't in an enormous number of files.
Thanks, d.
-- Sent from my computer.
-- Sent from my computer. _______________________________________________ Yt-dev mailing list Yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
Ah, sorry I missed that discussion. It's probably easiest in terms of
total person-hours if I just get a script to re-write my PFs as
needed, since this is a non-standard issue.
Thanks,
d.
On Wed, Oct 26, 2011 at 10:00 AM, Matthew Turk
Hi David,
The change to parameter file parsing was discussed here:
http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-August/001486... (where I ask for people to test)
and here:
http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-August/001501...
The reason that it changed was an effort to pull all of the parameters in. The assumption was that the Enzo parameter files read by yt would almost always be written by Enzo itself and utilize a comment delimiter that Enzo uses ("#") at the start of the line. The usage of "//" at the end of a line in a parameter file written by Enzo is not currently supported. My suggestion would be to look into the code I mention as changed in the emails and see if you can come up with an elegant way of getting around the comments you use. However, I would prefer -- since I think you're the only person who has those comments written by Enzo in his source files -- that the change be minimally invasive and not change behavior for anyone else.
Once you have something sketched up, issue a pull request on BitBucket and we can review it. Thanks,
Matt
On Wed, Oct 26, 2011 at 11:25 AM, david collins
wrote: Sorry, I forgot to provide the failure info:
File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py", line 655, in __init__ StaticOutput.__init__(self, filename, data_style, file_style=file_style) File "/Users/dccollins/local/src/yt-hg/yt/data_objects/static_output.py", line 86, in __init__ self._parse_parameter_file() File "/Users/dccollins/local/src/yt-hg/yt/frontends/enzo/data_structures.py", line 745, in _parse_parameter_file param, vals = (i.strip() for i in line.split("=")) ValueError: too many values to unpack
and "line" is
WriteBoundary = 0 //1=already written, 2=start writing
Previously I was using changeset 9b4ff0766c9c (which may be quite old), and I'm on 6267774e2f34 presently.
d.
On Wed, Oct 26, 2011 at 9:11 AM, david collins
wrote: Hi, all--
I've notice that trailing comments are not longer ignored when parsing parameter files. I have a parameter in many of my parameter files that documents itself, as in
WriteBoundary = 0 //1=already written, 2=start writing
which recently started causing the parameter file to parse. Is this an easy thing to fix in yt, or was this change done intentionally for a broader reason, and I should write a sed script to pull this out? I wouldn't bother asking if it weren't in an enormous number of files.
Thanks, d.
-- Sent from my computer.
-- Sent from my computer. _______________________________________________ Yt-dev mailing list Yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
_______________________________________________ Yt-dev mailing list Yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
-- Sent from my computer.
participants (2)
-
david collins
-
Matthew Turk