Can't figure this out

Hi,
I’m going out of my mind trying to figure this out. I keep getting the
following error.

E:/Apps/Ruby200-x64/lib/ruby/2.0.0/fileutils.rb:1563:in path': no implicit conversion of nil into String (TypeError) from E:/Apps/Ruby200-x64/lib/ruby/2.0.0/fileutils.rb:1563:infu_each_src_dest0’
from E:/Apps/Ruby200-x64/lib/ruby/2.0.0/fileutils.rb:1549:in
fu_each_src_dest' from E:/Apps/Ruby200-x64/lib/ruby/2.0.0/fileutils.rb:508:inmv’
from
E:/apps/scripts/ruby/asura-non/FASB/process_FASB_gif_singles.rb:13:in
`’

This is what line 13 looks like:

FileUtils.mv(giffile, “F:/workflows/grafix/asura-non/FASB/scratch_gif”)

I used to have “giffile = giffile.chomp” right above line 13, but, I
took it out. I can’t seem to find any consistency with regard to
“chomp.”

Any help would be appreciated.

Thank you,
Peter

On 01/16/2014 10:37 AM, Peter B. wrote:

from E:/Apps/Ruby200-x64/lib/ruby/2.0.0/fileutils.rb:508:in `mv’
“chomp.”

Any help would be appreciated.

Thank you,
Peter

Looks like giffile is nil. How it got to be nil no one can say without
seeing more of the code.

$ ruby -rfileutils -e ‘giffile = nil; FileUtils.mv(giffile,
“F:/workflows/grafix/asura-non/FASB/scratch_gif”)’
/home/justin/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:1585:in
path': no implicit conversion of nil into String (TypeError) from /home/justin/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:1585:infu_each_src_dest0’
from
/home/justin/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:1571:in
fu_each_src_dest' from /home/justin/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:514:inmv’
from -e:1:in `’

-Justin

OK. Well, here’s my code. This script is kicked off with a scheduling
utility that feeds it one file at a time, in this case, a GIF file. The
word “Orca” below is the name of our graphics server, which we HTTP
files to. Thanks a lot for your help.

require ‘rubygems’
require ‘fileutils’
require ‘net/ftp’

Dir.chdir(“F:/workflows/grafix/asura-non/FASB/in”)
if Dir.glob(“*.gif”).length == 0
exit
end

giffile = ARGV[0]

Dir.chdir(“F:/workflows/grafix/asura-non/FASB/in”)
FileUtils.mv(giffile, “F:/workflows/grafix/asura-non/FASB/scratch_gif”)

Dir.chdir(“F:/workflows/grafix/asura-non/FASB/scratch_gif”)

giffile = giffile.chomp
File.rename(“#{giffile}”, “#{giffile.downcase}”)
tifffile = File.basename(giffile, “.") + “.tif”
pdffile = File.basename(giffile, ".
”) + “.pdf”
pngfile = File.basename(giffile, “.*”) + “.png”
t = Time.now
begin
alchemy #{giffile} -t1 -D 72 72 -o
rescue
File.open(“E:/logs/statusreports/FASB.log”, “a”) { |f| f.print "
#{tifffile} file couldn’t be created from #{giffile} at
#{t.strftime(“%m/%d/%y %H:%M %p”)}. Alchemy fails.\n" }
end
begin
alchemy #{giffile} --d6 -o
rescue
File.open(“E:/logs/statusreports/FASB.log”, “a”) { |f| f.print "
#{pdffile} file couldn’t be created from #{giffile} at
#{t.strftime(“%m/%d/%y %H:%M %p”)}. Alchemy fails.\n" }
end
begin
alchemy #{giffile} ---n9 --yd 72 72 -D 72 72 -o
rescue
File.open(“E:/logs/statusreports/FASB.log”, “a”) { |f| f.print "
#{pngfile} file couldn’t be created from #{giffile} at
#{t.strftime(“%m/%d/%y %H:%M %p”)}. Alchemy fails.\n" }
end

#Send to Orca
t = Time.now
begin
curl -u production:prod --data-binary @#{tifffile} -H "Content-type: application/image" -H "Expect: " http://ps2000-graphics-test.bna.com/image/loader/#{tifffile}
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “Sent
to Orca: #{tifffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
rescue
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “NOT
sent to Orca: #{tifffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
system(“netmailbot -logfile E:/temp/netmailbot.log -appendlog -subject
"infocon bmp FILES: #{tifffile} did not go to Orca!" -to
[email protected] -fromfriendly "BNA Production Mail Server" -from
[email protected] -server 149.79.194.162”)
end

begin
curl -u production:prod --data-binary @#{pdffile} -H "Content-type: application/image" -H "Expect: " http://ps2000-graphics-test.bna.com/image/loader/#{pdffile}
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “Sent
to Orca: #{pdffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
rescue
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “NOT
sent to Orca: #{pdffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
system(“netmailbot -logfile E:/temp/netmailbot.log -appendlog -subject
"infocon bmp FILES: #{pdffile} did not go to Orca!" -to
[email protected] -fromfriendly "BNA Production Mail Server" -from
[email protected] -server 149.79.194.162”)
end

begin
curl -u production:prod --data-binary @#{pngfile} -H "Content-type: application/image" -H "Expect: " http://ps2000-graphics-test.bna.com/image/loader/#{pngfile}
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “Sent
to Orca: #{pngfile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
rescue
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “NOT
sent to Orca: #{pngfile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
system(“netmailbot -logfile E:/temp/netmailbot.log -appendlog -subject
"infocon bmp FILES: #{pngfile} did not go to Orca!" -to
[email protected] -fromfriendly "BNA Production Mail Server" -from
[email protected] -server 149.79.194.162”)
end

begin
curl -u production:prod --data-binary @#{giffile} -H "Content-type: application/image" -H "Expect: " http://ps2000-graphics-test.bna.com/image/loader/#{giffile}
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “Sent
to Orca: #{giffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
rescue
File.open(“E:/logs/StatusReports/FASB.log”, “a”) { |f| f.print “NOT
sent to Orca: #{giffile} at #{t.strftime(”%m/%d/%y %H%M %p")}\n" }
system(“netmailbot -logfile E:/temp/netmailbot.log -appendlog -subject
"infocon gif FILES: #{giffile} did not go to Orca!" -to
[email protected] -fromfriendly "BNA Production Mail Server" -from
[email protected] -server 149.79.194.162”)
end

#Send to BWD
#PDFs.
ftp = Net::FTP.open(‘genesis.bna.com’)
ftp.login(‘pb4072’, ‘retep1’)
ftp.chdir(‘/gateway/bwd/test/normal’)
ftp.putbinaryfile(pdffile.downcase)
File.delete(pdffile)

#PNGs.
ftp = Net::FTP.open(‘genesis.bna.com’)
ftp.login(‘pb4072’, ‘retep1’)
ftp.chdir(‘/gateway/bwd/test/normal’)
ftp.putbinaryfile(pngfile.downcase)
File.delete(pngfile)

#GIFs
ftp = Net::FTP.open(‘genesis.bna.com’)
ftp.login(‘pb4072’, ‘retep1’)
ftp.chdir(‘/gateway/bwd/test/normal’)
ftp.putbinaryfile(giffile.downcase)
File.delete(giffile)

#Delete the TIFF files.
FileUtils.rm(tifffile)

On 01/16/2014 11:10 AM, Peter B. wrote:

if Dir.glob("*.gif").length == 0
exit
end

giffile = ARGV[0]

Dir.chdir(“F:/workflows/grafix/asura-non/FASB/in”)
FileUtils.mv(giffile, “F:/workflows/grafix/asura-non/FASB/scratch_gif”)

Personally, I would check that ARGV[0] is not nil. It’s possible your
scheduling utility is passing in an blank file name or something.

-Justin