# Error loading dependencies

**URL:** <https://forums.sketchup.com/t/error-loading-dependencies/216278>\
**Category:** Ruby API\
**Created:** [December 27, 2022, 4:36pm UTC](https://forums.sketchup.com/t/error-loading-dependencies/216278 "2022-12-27T16:36:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtches](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/rtches/32/131827_2.png) [@rtches](https://forums.sketchup.com/u/rtches)\
**Post date:** [December 27, 2022, 4:36pm UTC](https://forums.sketchup.com/t/error-loading-dependencies/216278/1 "2022-12-27T16:36:17Z")

</div>

I have encripted a new extension and it works perfectly on my mac. When I encripted and obtained my rbz file I receive this error message while I load Sketchup

```auto
Error: #<LoadError: cannot load such file -- c:/users/rafaelteresachinchil/appdata/roaming/sketchup/sketchup 2022/sketchup/plugins/skp4d/aux code/sketchup4D functions.rb>
C:/Program Files/SketchUp/SketchUp 2022/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:92:in `require'
C:/Program Files/SketchUp/SketchUp 2022/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:92:in `require'
c:/users/rafaelteresachinchil/appdata/roaming/sketchup/sketchup 2022/sketchup/plugins/skp4d/sketchup4d.rbe:4:in `<main>'
C:/Program Files/SketchUp/SketchUp 2022/Tools/extensions.rb:197:in `eval'
C:/Program Files/SketchUp/SketchUp 2022/Tools/extensions.rb:197:in `require'
C:/Program Files/SketchUp/SketchUp 2022/Tools/extensions.rb:197:in `load'
C:/Users/rafaelteresachinchil/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/skp4D.rb:11:in `register_extension'
C:/Users/rafaelteresachinchil/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/skp4D.rb:11:in `<top (required)>'

```

I have this lines in sketchup4d.rb

```rb
require 'json'
require 'sketchup.rb'
require File.join(File.dirname( __FILE__ ), '/aux code/sketchup4D functions.rb') #required at start

```

After the encription both sketchup4d.rb and sketchup4D functions.rb changed to .rbe.  
Is ther any problem with spaces in files or folder names?

---

<div class="post-metadata">

**Author:** ![slbaumgartner](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/slbaumgartner/32/7302_2.png) [@slbaumgartner](https://forums.sketchup.com/u/slbaumgartner)\
**Post date:** [December 27, 2022, 5:06pm UTC](https://forums.sketchup.com/t/error-loading-dependencies/216278/2 "2022-12-27T17:06:43Z")

</div>

For encrypted rubies you must use Sketchup::require. The basic require doesn’t know about encrypted.

---

<div class="post-metadata">

**Author:** ![rtches](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/rtches/32/131827_2.png) [@rtches](https://forums.sketchup.com/u/rtches)\
**Post date:** [December 27, 2022, 5:39pm UTC](https://forums.sketchup.com/t/error-loading-dependencies/216278/3 "2022-12-27T17:39:15Z")

</div>

Thanks @slbaumgartner it worked!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 27, 2022, 11:27pm UTC](https://forums.sketchup.com/t/error-loading-dependencies/216278/4 "2022-12-27T23:27:02Z")

</div>

> [@rtches](#):
>
> When I encripted and obtained my rbz file I receive this error message while I load Sketchup …

The answer was given on this Help Center page (under the section **Ruby Encryption** ) …

- [https://help.sketchup.com/en/extension-warehouse/extension-encryption-and-signing](https://help.sketchup.com/en/extension-warehouse/extension-encryption-and-signing)

* * *

Just a note to explain that the extension registrar script and the extension subfolder should normally be a concatenation of the namespace module and the submodule (or extension name.)

So if your top level namespace module is named `Rafa` (just for example’s sake,) then the extension registrar script and the extension subfolder would be named …  
`Rafa_SketchUp4D` or `rafa_sketchup4d` (if you’re one of those that like to downcase all files names.)

The files themselves would be module wrapped similar to …

```ruby
module Rafa
  module Skp4D

    # ... All code inside the extension submodule ...

  end
end

```

* * *

> [@rtches](#):
>
> ```ruby
> require File.join(File.dirname( __FILE__ ), '/aux code/sketchup4D functions.rb')
> 
> ```

You might as well just use the global method [` __dir__ ()`](https://ruby-doc.org/core-2.7.2/Kernel.html#method-i- __dir__ ) since you want the current directory,  
and we omit the filetype when using [`Sketchup::require`](https://ruby.sketchup.com/Sketchup.html#require-class_method) so it can load both `.rb` and `rbe` files, ie:

```ruby
Sketchup.require(File.join( __dir__ , '/aux code/sketchup4D functions'))

```
