Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ CLI: unable to update ReportingMeasure with 3.7.0-rc3 #5045

Closed
jmarrec opened this issue Nov 17, 2023 · 3 comments · Fixed by #5046
Closed

C++ CLI: unable to update ReportingMeasure with 3.7.0-rc3 #5045

jmarrec opened this issue Nov 17, 2023 · 3 comments · Fixed by #5046

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Nov 17, 2023

Issue overview

Reported by @shorowit

I'm using the OS rc3 and it's giving an error when I try to update a reporting measure:

Current Behavior

shorowit@SHOROWIT-36132S:/mnt/c/git/openstudio-hpxml$ ~/OpenStudio-3.7.0-rc3+37087fd612-Ubuntu-20.04-x86_64/usr/local/openstudio-3.7.0-rc3/bin/openstudio measure -u ReportUtilityBills/
Attempting to load measure 'ReportUtilityBills/'
Successfully loaded measure 'ReportUtilityBills/'
Changes detected, updating 'ReportUtilityBills/'
className=ReportUtilityBills
measureType=ReportingMeasure
numArgs=-1
SWIG director method error. NameError: undefined local variable or method `e' for #<OpenStudio::Measure::RubyMeasureInfoBinding:0x00007fffdd27ccb8>

Traceback (most recent call last):
eval:211:in `rescue in renderFile'
eval:205:in `renderFile'

Expected Behavior

It should work, like the classic subcommand does

Steps to Reproduce

You can presumably reproduce it by cloning https://github.com/NREL/OpenStudio-HPXML/tree/os370rc2
(I get the same error if I try the other reporting measure in that repo -- ReportSimulationOutput)

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): all
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.7.0-rc3

Context

@jmarrec
Copy link
Collaborator Author

jmarrec commented Nov 17, 2023

Should be rescue => e. Still fails to produce an ERB though, tracking it down...

@jmarrec
Copy link
Collaborator Author

jmarrec commented Nov 17, 2023

Ok I see, I removed the begin / rescue so I could see the error. We should do that by default, but I don't want to break the old CLI.

SWIG director method error. NoMethodError: undefined method `join' for nil:NilClass

Traceback (most recent call last):
(erb):25:in `block in renderFile'
(erb):13:in `each'
(erb):13:in `renderFile'
:/ruby/2.7.0/erb.rb:905:in `eval'
:/ruby/2.7.0/erb.rb:905:in `result'
eval:209:in `renderFile'

Pretty sure this is happening here: https://github.com/NREL/OpenStudio-HPXML/blob/56d57315544662843cdd46de72f61d684ae8fa1f/ReportUtilityBills/README.md.erb#L24-L26

<% if argument[:type] == "Choice" %>
- **Choices:** `<%= argument[:choice_values].join("`, `") %>`
<% end %>

FWIW, the BCL template if our repo does it differently, so that's probably why I haven't caught this one before.

<% if argument[:type] == "Choice" && !argument[:model_dependent]%>
**Choice Display Names** <%= argument[:choice_display_names] %>
<% end %>

@jmarrec
Copy link
Collaborator Author

jmarrec commented Nov 17, 2023

TL;DR: the winner is: A TYPO!

auto& choiceValues = root["choices_values"];

@jmarrec jmarrec self-assigned this Nov 17, 2023
@jmarrec jmarrec closed this as completed Dec 11, 2023
@jmarrec jmarrec reopened this Dec 11, 2023
jmarrec added a commit that referenced this issue Dec 11, 2023
Fix #5045 - Fix typo in OSArgument::toJSON + improve reporting when README ERB generation fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant