First time here? Check our help page!
1

loading an external gem in a measure [closed]

I'm trying to solve a problem that has occurred when updating to version 2.1 of OpenStudio. I did not have this problem in the 1.11.x versions of OpenStudio. I'm sure that it is an issue with how my Ruby environment is set up. I am running on a *nix enviroment (in this case, Mac).

The actual gem I am trying to use is the mongo gem, so in my ruby measure I have a simple require statement at the top require 'mongo'

When I load the measure in OpenStudio, the measure shows the red broken scroll, and the message 'cannot load such file -- mongo'

I use RVM to manage my ruby environment. I've double checked to ensure that both gem folders under ~/.rvm for both ruby versions on my machine (2.0.0 and 2.2.0), to ensure there is a mongo folder in there. But, regardless, even if I reboot my machine, restart OpenStudio, I still see the same message and same broken red scroll.

Are there any tricks to try and solve this, e.g. - rvm pristine or a different way to configure ~/.bashrc ?

Chienman's avatar
588
Chienman
asked 2017-06-11 23:45:33 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-06-12 06:18:51 -0500
edit flag offensive 0 remove flag reopen merge delete

Closed for the following reason "duplicate question" by David Goldwasser 2017-06-21 16:46:30 -0500

Comments

Someone mentioned checking my GEM_PATH. I've tried updating my GEM_PATH on my mac to the local gem folders on the machine. Everywhere and anywhere that I've installed the mongo gem, I've referenced it in GEM_PATH. But still getting the broken red scroll.

Chienman's avatar Chienman (2017-06-13 11:33:09 -0500) edit

What is even MORE odd, is that I have other measures with the same require 'mongo' command and it seems to be loading fine. So what could be the underlying reason why this is happening?

This is true until I edit the measure, and save it. When I save it, now I am getting the same broken scroll. Very odd behavior.

Chienman's avatar Chienman (2017-06-13 11:45:38 -0500) edit
add a comment see more comments

1 Answer

1
aparker's avatar
8.2k
aparker
answered 2017-06-21 10:52:42 -0500
edit flag offensive 0 remove flag delete link

Comments

I have, and neither of those things solved my problem unfortunately. It's quite difficult to diagnose the rubies and gems, so it is possible I've done something wrong. But you would think that if you simply point the OS ruby to the right folder, it would simply work.

I tried both approaches shown in the question, but still no luck. I've had to modify my measure and workflow to work in 2.1.0 for now.@julien also is stating he's having trouble as well.

Chienman's avatar Chienman (2017-06-22 13:17:13 -0500) edit
add a comment see more comments