Gem install aws-sdk

Hey buddys,

sorry to bother you again …

I’m trying to install the aws sdk in SU2020, but to no avail.
Did someone installed it?

follow what i’m doing

Console log error:

true
“no implicit conversion of Sketchup::Console into String (Line 1)”
Error: #<TypeError: no implicit conversion of TypeError into String>
“myuser”/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:346:in +' "myuser"/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:346:in rescue in block in initialize’
“myuser”/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:335:in `block in initialize’

thanks!!!

I just tested using the native Ruby Console (not the AS Ruby Code Editor) and it takes a few minutes, but the gem does install in SU2020.

1 Like
  1. I believe this is discourse, so it supports some markdown. Please enclose console/log/code in triple backticks so it’s readable (like the below code)

  2. Some Ruby code doesn’t deal with spaces in paths, and the folder ‘SketchUp 2020’ has a space. Your username may also have a space.

  3. STDOUT and $stdout aren’t the same in SU, and Sketchup::Console doesn’t have all the methods of STDOUT/IO.

    STDOUT.class    #-> IO
    $stdout.class   #-> Sketchup::Console
    
1 Like

Hi Dan,
I recently tried the same in Sketchup 2019 ruby console. The Gem install

Gem.install(‘aws-sdk-s3’)

part goes through but if you do

require ‘aws-sdk-s3’

it fails. I getting the following error

Error: #<TypeError: no implicit conversion of Sketchup::Console into String>
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:746:in `initialize'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:746:in `open'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:746:in `open_logfile'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:738:in `set_dev'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:673:in `initialize'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:387:in `new'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/logger.rb:387:in `initialize'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:23:in `new'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:23:in `<class:ConnectionPool>'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:19:in `<module:NetHttp>'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:17:in `<module:Client>'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:15:in `<module:Seahorse>'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse/client/net_http/connection_pool.rb:14:in `<top (required)>'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse.rb:36:in `require_relative'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/seahorse.rb:36:in `<top (required)>'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Users/Ajay/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Gems64/gems/aws-sdk-core-3.124.0/lib/aws-sdk-core.rb:4:in `<top (required)>'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'

Beware that we strongly recommend not using Gem.install for production extension that’s released to end users. More details in this post: Install Prawn gem in SketchUp 2016 - #2 by tt_su

The SKETCHUP_CONSOLE object takes control of STDIN and STDOUT.
So apparently the standard library Logger is not compatible with SketchUp’s embedded Ruby process.
Likely because the console is not a subclass of the IO class.

1 Like
  • Use standalone Ruby (matching the versions for your target SketchUp) and install the gem there. Then you can copy the gem to your extension.

How can I do it? system('gem install aws-sdk-s3') installs in Sketchup’s Gems directory.
Also, the same Ruby version might not be installed at the user’s end.

I will check this.

What I recommend is that you modify the gem to be wrapped in your extension’s namespace. Just building and installing it locally and bundling it isn’t enough as you’d still have the issue namespace collisions.

1 Like

No, just no.

  1. What Thomas (@tt_su) said is correct, re the namespace collisions.

  2. Have a look at a recent CI test run for the SDK. I think there are eight instances of ‘with native extensions’, which means that eight of the gems that are dependencies of the SDK are extension gems, which require compiling. Some could be dependencies used just for testing, but they don’t look like they are (see the Gemfile).

  3. Re compiling extension gems, new versions of SU Ruby are mswin builds, most gems don’t test against mswin, but against mingw64 or ucrt64. So, they may not build, or, if they build, they may not work. Some don’t even test against Windows Ruby.

  4. One might be able to set ENV['PURE_RUBY'] = '1' and install the SDK, but that may be slow, since the json and xml parsing will be done in Ruby code, not compiled c. And possibly other things…

Lastly, the SDK is divided into quite a few gems (see https://rubygems.org/search?query=aws-sdk). Installing a portion of the SDK might be an easier task.

1 Like