From: Nathan Thickett-menghini Date: 2007-09-15T23:07:40+09:00 Subject: errors, trying to edit and write some text files Hi, I'm a total ruby noob but i've obtained this script from another forum over at Tracks. I'm trying to extract some info from a plain text feed of my upcoming calendar events and write specific info to three different text files (today, tomorrow, and next 7 days). I'm on a Mac. The script is here: I've already made edits specific to my computer (the address of my text feed for example): #!/usr/bin/ruby # Generate 3 seperate text files from Tracks TXT feeds # listing actions due today (or overdue), tomorrow or # in the next 7 days. # You can then pull these text files into GeekTool and colour # them separately. # ======== Constants to set with your values =============== # # URL for the base feed: http://yourdomain.tld/feed/text/[token] URL = "http://0.0.0.0:3000/feed/text/Nathan/b0b2a7c81680d1a1920b199ecb6db0ad86e2e984" # Path to temporary directory TEMP_DIR = "/Users/" # # ============================================= # Grab each feed, split into lines, then get rid of any non-action lines today = `curl -s "#{URL}"?due=0`.split("\n").select{|line| line =~ /\s+\[Due:/ or line =~ /^\w/} tomorrow = `curl -s "#{URL}"?due=1`.split("\n").select{|line| line =~ /\s+\[Due:/ or line =~ /^\w/} this_week = `curl -s "#{URL}"?due=6`.split("\n").select{|line| line =~ /\s+\[Due:/ or line =~ /^\w/} # Get rid of repeated actions in tomorrow and this_week tomorrow = tomorrow - today today_or_tomorrow = today + tomorrow this_week = this_week - today_or_tomorrow # Print the info to three files, stored in TEMP_DIR file = File.new("#{TEMP_DIR}/today.txt", "w")   file.print "\nToday:\n" + today.join("\n") file.close file = File.new("#{TEMP_DIR}/tomorrow.txt", "w")   file.print "\nTomorrow:\n" + tomorrow.join("\n") file.close file = File.new("#{TEMP_DIR}/later.txt", "w")   file.print "\nLater:\n" + this_week.join("\n") file.close When I run this from BBEdit I get about 50 lines of this: untitled text:11: Invalid char `\302' in expression untitled text:11: Invalid char `\240' in expression untitled text:11: Invalid char `\302' in expression untitled text:11: Invalid char `\240' in expression untitled text:13: Invalid char `\302' in expression untitled text:13: Invalid char `\240' in expression untitled text:13: Invalid char `\302' in expression untitled text:13: Invalid char `\240' in expression untitled text:17: Invalid char `\302' in expression untitled text:17: Invalid char `\240' in expression untitled text:17: Invalid char `\302' in expression untitled text:17: Invalid char `\240' in expression Any ideas? Sorry if this appears obvious. Many thanks. -- Posted via http://www.ruby-forum.com/.