# Requiring Files while working Remotely

**URL:** <https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749>\
**Category:** Ruby\
**Created:** [July 18, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749 "2007-07-18T16:51:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [July 18, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/1 "2007-07-18T16:51:25Z")

</div>

Hello,

I’m trying to execute a script on my local machine which requires a file  
on a remote machine. When i run the program on my local machine i get  
an error saying that ruby couldn’t load a file that is being required by  
file on remote machine; both of these files are in the same directory  
(on the remote machine).  
Here’s the error:  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require': no such file to load -- ExcelModule.rb (LoadError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from \3833-9-CCC-w520\AutoLib\TestBed.rb:49  
from c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from Registration.rb:7

Everything works fine when i work directly on the remote machine.

Both of the machines have same version of ruby. Both are windows xp  
sp2.

Thanks for your help in advance.

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [July 18, 2007, 6:51pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/2 "2007-07-18T18:51:31Z")

</div>

Anybody?

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [July 18, 2007, 8:03pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/3 "2007-07-18T20:03:35Z")

</div>

El Jul 18, 2007, a las 4:51 PM, Parv G.  
escribió:

> (LoadError)
> 
> Both of the machines have same version of ruby. Both are windows xp  
> sp2.

The regular library loading mechanism assumes a local filesystem.  
Just copy that missing file locally.

– fxn

PS: Loading a remote library would involve two steps:

1. downloading the actual file

2. eval’ing its contents somehow

That’s technically possible, but you’d need to do it by hand. I think  
this technique is not what you are looking for nonetheless, copying  
the missing file to that second machine is the easiest approach if  
that’s valid.

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [July 18, 2007, 8:41pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/4 "2007-07-18T20:41:39Z")

</div>

On Wed, 18 Jul 2007 23:51:28 +0900, Parv G. wrote:

> (LoadError)  
> from c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `require' from \\3833-9-CCC-w520\AutoLib\TestBed.rb:49 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_require’  
> from c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `require’  
> from Registration.rb:7

You’re trying to load from “\3833-9-CCC-w520\AutoLib\TestBed.rb”? Try  
mapping the remote directory to a drive letter.

–Ken

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [July 18, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/5 "2007-07-18T20:37:22Z")

</div>

Xavier N. wrote:

> The regular library loading mechanism assumes a local filesystem.  
> Just copy that missing file locally.

And it (ruby library loading mechanism) works as designed. What i did  
was change the path to the file being required on remote machine.

So on remote machine i changed the driver script like this:  
require “c:/lib/file.rb” changed it to -\> require  
“\\machine-address\lib\file.rb”

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [September 25, 2007, 11:09pm UTC](https://www.ruby-forum.com/t/requiring-files-while-working-remotely/109749/6 "2007-09-25T23:09:43Z")

</div>

If the remote file is requiring other files in the same directory,  
you’ll probably need to add the path to your list:  
$:.unshift File.join(File.dirname( **FILE** ),".")
