2

Running Openstudio measure tests in the command line with Ruby

I am attempting to run the test file AssignSpaceTypeToBuilding_Test from the command line to make sure that Ruby and Openstudio are working properly on my machine. My end goal is to automate running several measures from the command line. However, whenever I run even the first line of test file code:

require 'openstudio'

The following cryptic error appears in the the command window:

DL is deprecated, please use Fiddle C:/Ruby200/lib/ruby/2.0.0/rubygems/coreext/kernelrequire.rb:44:in 'require': 1 93: %1 is not a valid Win32 application - C:/Program Files/OpenStudio 1.6.0/Ruby/openstudio/openstudioutilitiescore.so (Load Error)

I followed all of the installation instructions as described here: nrel.github.io/OpenStudio-user-documentation/gettingstarted/gettingstarted/

Any idea what the problem could be? I am at a loss as I have tried both the 64 and 32 bit versions of Ruby and neither work. I am currently running: OpenStudio 1.6.0 Ruby 2.0.0-p594

Any help would be greatly appreciated!

dpud12's avatar
1.3k
dpud12
asked 2015-02-23 08:17:09 -0500, updated 2015-02-23 08:24:32 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

I think the problem is with your Ruby version. Here's the response I got from @macumber when I emailed about this error:

this is likely due to the change of Ruby 2.0 version we had to make to match SketchUp’s version in 2015. You will now need the 64 bit MinGW version of Ruby 2.0. Also you have to use 32 bit version of Ruby to work with 32 bit version of OpenStudio and similar for 64 bit. Here is the version of Ruby that I am using with OS 1.6.0 (x64):

C:\Users\dmacumbe>ruby -v ruby 2.0.0p594 (2014-10-27) [x64-mingw32]

ericringold's avatar
10.6k
ericringold
answered 2015-02-23 09:42:07 -0500
edit flag offensive 0 remove flag delete link

Comments

Our updated measure testing documentation shows what the measure test code should like. Here is a link specifically to the MiniTest code.

Also, here is a link to the previous post that Eric mentioned.

David Goldwasser's avatar David Goldwasser (2015-02-23 09:52:15 -0500) edit

@Eric Ringold and @David Goldwasser, thank you both for your insights. Eric, it was indeed a version problem, runs great with Ruby 2.0.0-p594-x64. However, there was one additional bug. When I entered the code from the install site line for line (Step 3 in the Optional - Install Ruby portion), I got the error:

...openstudio.rb:1:in '(main)': undefined method 'ruby' for main:Object (NoMethodError)

dpud12's avatar dpud12 (2015-02-23 11:00:12 -0500) edit

I solved this error by changing the suggested line of code in Step 3 from:

ruby require 'C:\Program Files\OpenStudio 1.6.0\Ruby\openstudio.rb'

to

require 'C:\Program Files\OpenStudio 1.6.0\Ruby\openstudio.rb'

Was I wrong in assuming that the text 'ruby' should be included in the code? It works perfectly without it now but I want to understand my error/why this text is listed on the site.

dpud12's avatar dpud12 (2015-02-23 11:04:12 -0500) edit

I think the leading ruby is an error in the installation instructions.

ericringold's avatar ericringold (2015-02-23 11:47:04 -0500) edit

Thanks @Eric Ringold, just fixed that page.

David Goldwasser's avatar David Goldwasser (2015-02-23 12:51:40 -0500) edit
add a comment see more comments