Okay, we've added that to the mac, and still the same error. I'm going
to post a little bit more of the code, it's 900+ lines long, so i'm
going to only put part of it, the main part of it is repeating for a
different thing.
///////////////// CODE BEGINING /////////////////
$defout.sync=true
attempt = 0
time = Time.now
day = time.wday
year = time.year
require 'uri'
require 'net/http'
require 'FileUtils'
require 'date'
require 'yaml'
# //** Captions Infomation **//
captions_number = YAML.load(File.open("arrays/captions_number.yaml"))
captions = YAML.load(File.open("arrays/captions_array.yaml"))
captions_delete = []
def image_exists?(url_string)
url = URI.parse(url_string)
Net::HTTP.start(url.host, url.port) do |http|
response = http.head(url.path)
case response
when Net::HTTPSuccess, Net::HTTPRedirection
case response.content_type
when "image/png", "image/gif", "image/jpeg"
return true
end
end
end
return false
end
def user_wants_to_save?(url)
print "#{url}"
puts ""
#puts "Time: " + time.to_s
puts "Delete Permanently? [y/N]: "
input = $stdin.gets
if /y/i =~ input
return true
else
return false
end
end
while(attempt >= 0)
time = Time.now
attempt += 1
print "\n", "------------------- ", attempt.to_s, " - ", time.hour,
":", time.min, ":", time.sec, " -------------------", "\n"
# //** Captions **//
captions.each do |url|
if image_exists?(url)
if user_wants_to_save?(url)
captions_delete.push url
end
end
end
captions_delete_number = captions_delete.length
captions_delete_number -= 1
while(captions_delete_number >= 0)
captions.delete(captions_delete[captions_delete_number])
captions_delete.delete(captions_delete[captions_delete_number])
captions_delete_number -= 1
end
while(captions.length < 8)
captions_number += 1
captions.push "http://images.neopets.com/caption/sm_caption_" +
captions_number.to_s + ".gif"
end
File.open("arrays/captions_array.yaml","w") do |out|
out << captions.to_yaml
end
File.open("arrays/captions_number.yaml","w") do |out|
out << captions_number.to_yaml
end
//////// END OF CODE ////////////
Basically it's a program that checks to see if images exist. =D Now,
with the proper files and everything, it works wonders on windows.
However, even adding the require 'yaml' didn't work. It was there from
the beginning, so that couldn't be the problem - unless you have to have
"yaml" on the mac somewhere?!?
···
--
Posted via http://www.ruby-forum.com/.