JGCRI/pygcam

"Can't read XML file" containing queries after model run

imanyakin opened this issue · 6 comments

After performing a run (gt run) of the default model generated, there appears to be a problem with the configured queries giving the following error:

INFO pygcam.project: [base, 3, query] @query -o "/home/ilya/spaces/workspace/tenokonda/projects/tkia/GCAM/sandboxes/test/base/queryResults" -w "/home/ilya/spaces/workspace/tenokonda/projects/tkia/GCAM/sandboxes/test/base" -s "base" -q "/tmp/tmplfbhowbg.queries.xml"
gt failed: Can't read XML file '/tmp/tmplfbhowbg.queries.xml': Extra content at the end of the document, line 7, column 1 (tmplfbhowbg.queries.xml, line 7)

Issue #19 seemed related to this, but adding in the `queries' folder from the GCAM workspace to the sandbox doesn't seem to help.

Any suggestions are appreciated, thanks!

Hi. Please edit the <step name="query" ... > elements in project.xml to temporarily add the --noDelete option, which will allow you to look at the temporary file referenced in the error message. That will probably point us to the source of the problem. If you don't see an obvious problem, you can email it to me at rich@plevin.com.

The edited query step should look like this:

<step name="query" runFor="baseline">@query --noDelete -o {batchDir} -w {scenarioDir} -s {scenario} -Q "{queryPath}" -q "{queryXmlFile}"</step>

Hi Richard, thanks for your response!

With --noDelete I still get blank /tmp files - it does see the flag though (so project.xml modification registers):
INFO pygcam.project: [base, 3, query] @query --noDelete -o ... "base" -q "/tmp/tmp_2fjogkg.queries.xml"

I've also tried running the gt query subcommand directly with same options (from gt run -k setup -S base -n)
However that just throws an 'Error reading file... failed to load external entity'

I might be making the incorrect assumption that pygcam=1.11.0 is compatible with GCAM v6? - I say this as I've had to fix up the default sandbox (generated using gt init) as the <project>/sandboxes/base/input folder was missing so running gt run initially couldn't find the configuration XMLs (solved by copying over GCAM defaults)....another potential hint of this is:

WARNING pygcam.tool: Config parameters ['6.0.0', '6.0', '6'] are undefined.

So perhaps it's worth downgrading GCAM? Or are they meant to be compatible?

Oh -- sorry, I should have asked. Pygcam is not yet compatible with 6.0. (On it's home page here, you can see that v1.11 was released in April 2022, well before 6.0 arrived.)

Major releases of GCAM can reshuffle any number of things, like XML file structures, which need to be understood by pygcam. I'm not yet working with 6.0, so I haven't addressed it. I will try to get to it soon.

Ok great - hopefully that'll solve it! Just to confirm - the GCAM version compatible with the latest pygcam=1.11.0 is v5.4?

Yes, as mentioned in the release notes.

Thanks!