On Sun, Sep 4, 2011 at 2:35 AM, Jeffrey Smith <jesmith2095 / gmail.com> wrote: > > On Sep 3, 2011, at 7:39 PM, Hassan Schroeder wrote: > >> On Sat, Sep 3, 2011 at 4:26 PM, Jeffrey Smith <jesmith2095 / gmail.com> wrote: >>> I changed the slashed and escaped the file path ( I noticed after the fact that my path has spaces), and no change in the error at all. >> >>>> Again, what OS? << >> >> Have you tried 1) opening a file that's in the same directory you've >> started IRB in? 2) changing directories to the one with the target file >> and starting IRB there? >> >> -- >> Hassan Schroeder ------------------------ hassan.schroeder / gmail.com >> http://about.me/hassanschroeder >> twitter: @hassan >> > > The OS is Windows 2003. > > I can open the file from the cmd line (not IRB), and when I hardcode the path in File.open(\\\\sdcfaxgw04\\c$\\epic\\jobs\\Processed\\7.7.7\\Epic Print Service\\xxx) it works fine. This cannot work. You need at least quotes to make that valid Ruby code. Please show the *exact* code you are using. > I created the variable by combining two other variables, and when I try the File.exists? it fails. If I assign the complete path including file (i.e. \\\\sdcfaxgw04\\c$\\epic\\jobs\\Processed\\7.7.7\\Epic Print Service\\sd3n4v1.20110902.1924.55435838.JMym.epic) it works fine. > > Could it be the way I'm creating the variable? This is the process: > > ertf = "\\\\sdcfaxgw04\\c$\\epic\\jobs\\Processed\\7.7.7\\Epic Print Service\\"+filevariable What is in filevariable? Do you happen to read "filevariable" from stdin? Then this is what happens: irb(main):001:0> File.open("price.sql").close => nil OK, file is there. Now the test: irb(main):002:0> filevariable = gets price.sql => "price.sql\n" irb(main):003:0> File.open(filevariable).close Errno::ENOENT: No such file or directory - price.sql from (irb):3:in `initialize' from (irb):3:in `open' from (irb):3 from /usr/local/bin/irb19:12:in `<main>' Note the trailing newline. You can get rid of it by doing irb(main):004:0> filevariable.chomp! => "price.sql" irb(main):005:0> filevariable => "price.sql" Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/