Failed to open TCP connection

Hey guys, I’m here again bringing some issues hahaha

This time my problem is:

Error Loading File CollectionPlugin.rb
Error: #<TypeError: Failed to open TCP connection to (no implicit conversion of nil into String)>
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/net/http.rb:939:in rescue in block in connect' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/net/http.rb:936:in block in connect’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/timeout.rb:93:in block in timeout' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/timeout.rb:103:in timeout’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/net/http.rb:935:in connect' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/net/http.rb:920:in do_start’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/net/http.rb:909:in start' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:337:in open_http’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:755:in buffer_open' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:226:in block in open_loop’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:224:in catch' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:224:in open_loop’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:165:in open_uri' C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:735:in open’
C:/Program Files/SketchUp/SketchUp 2020/Tools/RubyStdLib/open-uri.rb:35:in open' C:/Users/Daniel/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/CollectionPlugin.rb:152:in block in initialCfg’
C:/Users/Daniel/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/CollectionPlugin.rb:148:in each' C:/Users/Daniel/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/CollectionPlugin.rb:148:in initialCfg’
C:/Users/Daniel/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/CollectionPlugin.rb:162:in <module:CriaPlugin>' C:/Users/Daniel/AppData/Roaming/SketchUp/SketchUp 2020/SketchUp/Plugins/CollectionPlugin.rb:7:in <top (required)>’

PS: collectionplugin is my plugin and is where some of our assets are.

This problem happens just for somes people, looks like the sketchup is blocking external connection, I already did a lot of tests, like access the from the browser (outside of sketchup) and works normally. The problem is only inside Sketchup.

Has anyone seem something similir or has any idea?

thanks a lot buddys!!

  1. You are using the Ruby Standard Lib Net::Http which is blocking. (Ie, the SketchUp application can go into not responding mode if there are latency problems.)

    • You might try using the SketchUp API’s Sketchup::Http asynchronous classes.
  2. The error …
    Error: #<TypeError: Failed to open TCP connection to (no implicit conversion of nil into String)>
    … indicates that your code is not checking for a nil return from some call before it passes the result to something that expects a String object.
    So, … code defensively.

  3. Error Loading File CollectionPlugin.rb
    You should not be doing a net connection during a file load.
    SketchUp extensions are event driven code objects.

  4. Is your extension using the SketchupExtension class and following best practices ?

Hi Dan,

Thanks for reply,
actually looks a cascade error caused by the connection blocking,
but I’ll see the best practices again.

thanks for help.

@DanRathbun. You should get paid for delivering this kind of support.