Gem install resulting in Not Responding of Sketchup

Hi,
When I am trying to install the gem using

    begin
      require "aws-sdk-s3"
    rescue LoadError
      Gem.install("aws-sdk-s3")
      require "aws-sdk-s3"
    end

Sketchup first goes to not responding state. Then after a while it gives

Error Loading File C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2018/SketchUp/Plugins/sentio/ruby/sentioloader.rb
Error: #<LoadError: cannot load such file – aws-sdk-s3>
C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in require' C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:inrequire’
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2018/SketchUp/Plugins/sentio/ruby/sentioloader.rb:15:in <top (required)>' C:/Program Files/SketchUp/SketchUp 2018/Tools/extensions.rb:197:inrequire’
C:/Program Files/SketchUp/SketchUp 2018/Tools/extensions.rb:197:in load' C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2018/SketchUp/Plugins/sentio.rb:46:inregister_extension’

After that i checked the gems folder - SketchUp\SketchUp 2018\SketchUp\Gems64\gems. All the required gems where downloaded.
Now when i restart the Sketchup my extension loads correctly.

SketchUp is freezing because the Gems library downloads synchronously (blocking operation) so that the next line of code won’t be executed before the installation is completed. Why the require code fails is something I don’t know either.

If Ruby was more event-based, this could be solved with an asynchronous callback where SketchUp remains responding and continues loading, but your plugin is only loaded when the callback is executed.

1 Like

Even if we ignoring the not responding problem is there any solution or Gem.install will not work ?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.