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’
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.
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.
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.
What Thomas (@tt_su) said is correct, re the namespace collisions.
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).
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.
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.
It could be done… but when my extension starts there is that already discussed error:
Error: #<TypeError: no implicit conversion of Sketchup::Console into String>
As far as I understand it right now, there is a conflict of the way the aws gems use the “STDIN and STDOUT” - and this conflict between SketchUp and the aws gems can be solved? Did ever someone sort this out? Is there a way to use aws s3 by ruby code within a SketchUp -Extension?
Even when someone takes the work to modify the aws gems ‘to be wrapped within the extension code and namespace’ - the work of making STDOUT compatible still needs to be done - right?
To find a solution I tried to call aws cli by “system” calls within the extension. This is working on Windows - but on MacOS just within debug mode. I would like a solution that is working on Windows and on MacOS…
It was a while ago, but I think I had the same issue with the aws gems. It is probably not an elegant solution, but this is what I do (in Windows and Mac)