From: Tamara Temple Date: 2013-07-05T10:00:25+09:00 Subject: Re: Loading csv giving error On Jul 4, 2013, at 3:07 PM, Nithi anand wrote: > hi guys I am trying to compare some data so I create one file name > called "Price_lookup" in notepad then saved in plugin folder > "Price_lookup.csv". > Price_lookup.csv contain like below > > "PARTNO", "PRICE" > 600157,402.20 > 600163,424.16 > 600169,445.00 > 600175,468.96 > 600181,492.01 > 600187,516.69 > > then I wrote small ruby script for testing. when I start the sketchup > It's gives an error as follows "Error Loading File CSV_Test.rb no such > file to load -- csv". any idea what I am doing wrong here???? thank you What line number is appearing with that message? > > here is my code. > > > > require 'sketchup.rb' > require 'csv' > > def csv_Test > > model = Sketchup.active_model > ent = model.active_entities > > csv_text = File.read('Price_lookup.csv') > csv = CSV.parse(csv_text, :headers => true) > csv.each do |row| > result = csv.find {|row| row['PARTNO'] == '600181'} > > UI.messagebox "Your Output #{result}" > end > end > > if (not $csv_Test_menu_loaded) > > UI.menu("Tools").add_item("CSV_TEST") { csv_Test } > > $csv_Test_menu_loaded = true > end > > -- > Posted via http://www.ruby-forum.com/. >