Openstudio measure needs to access system variables

I am writing a measure that requires executing an external program. The external program location is determined by a windows environment variable. I am trying to access it using ruby ENV hash. This works fine when running the measure in a unittest but it doesn't work when running the measure inside the openstudio app.

Any ideas?

mapascual's avatar
653
mapascual
asked 2020-05-15 05:21:53 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2020-05-15 10:53:36 -0500
edit flag offensive 0 remove flag close merge delete

Comments

what versions of ruby and openstudio / openstudio app are you using?

mdahlhausen's avatar mdahlhausen (2020-05-15 10:48:10 -0500) edit

Ruby: 2.2.6p396 OpenStudioApp: v2.9.0

mapascual's avatar mapascual (2020-05-15 11:30:11 -0500) edit

If you are starting the App by double clicking it might not be getting all of your environment variables. Try launching it from a command prompt instead.

I'd suggest logging the ENV in your measure to help debug:

runner.registerInfo("ENV = #{ENV}")

FYI, the environment used to start the OS CLI from the App is set up here

macumber's avatar macumber (2020-05-19 22:22:38 -0500) edit
add a comment see more comments