[MacRuby] #813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError)
#813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) ------------------------------+--------------------------------------------- Reporter: jadarkwah@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- '''macruby mrcsv.rb ''' /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1799:in `readline' from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1760:in `each' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:5:in `main' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:1:in `<main>' The following code works with ruby, ruby1.9 and jruby but chokes on macruby. '''#mrcsv.rb''' require 'csv' def main reader = CSV.open("mrtest.csv", "r") reader.each do |row| puts "#{row}" end end main '''#mrtest.csv''' 1,2,"River LINE",0 2,2,"Princeton Shuttle",0 3,2,"Atlantic City Rail Line",2 4,2,"Montclair-Boonton Line",2 5,2,"Montclair-Boonton Line",2 6,2,"Hudson-Bergen Light Rail",0 7,2,"Main/Bergen County Line",2 8,2,"Port Jervis Line",2 9,2,"Morris & Essex Line",2 10,2,"Gladstone Branch",2 11,2,"Northeast Corridor",2 12,2,"North Jersey Coast Line",2 13,2,"North Jersey Coast Line",2 14,2,"Newark Light Rail",0 -- Ticket URL: <http://www.macruby.org/trac/ticket/813> MacRuby <http://macruby.org/>
#813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) ------------------------------+--------------------------------------------- Reporter: jadarkwah@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by jadarkwah@…): It appears that if the lines in the csv file are quoted, then macuby acts as expected. So the following csv file works. "1,2,River LINE,0" "2,2,Princeton Shuttle,0" "3,2,Atlantic City Rail Line,2" "4,2,Montclair-Boonton Line,2" "5,2,Montclair-Boonton Line,2" "6,2,Hudson-Bergen Light Rail,0" "7,2,Main/Bergen County Line,2" "8,2,Port Jervis Line,2" "9,2,Morris & Essex Line,2" "10,2,Gladstone Branch,2" "11,2,Northeast Corridor,2" "12,2,North Jersey Coast Line,2" "13,2,North Jersey Coast Line,2" "14,2,Newark Light Rail,0" "15,2,Pascack Valley Line,2" "16,2,Princeton Shuttle,2" "17,2,Raritan Valley Line,2" "18,2,Meadowlands Rail Line,2" -- Ticket URL: <http://www.macruby.org/trac/ticket/813#comment:1> MacRuby <http://macruby.org/>
#813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) ------------------------------+--------------------------------------------- Reporter: jadarkwah@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by jadarkwah@…): Replying to [comment:1 jadarkwah@…]: Sorry but I forgot to preview the last comment. "1,2,River LINE,0" "2,2,Princeton Shuttle,0" "3,2,Atlantic City Rail Line,2" "4,2,Montclair-Boonton Line,2" "5,2,Montclair-Boonton Line,2" "6,2,Hudson-Bergen Light Rail,0" "7,2,Main/Bergen County Line,2" "8,2,Port Jervis Line,2" "9,2,Morris & Essex Line,2" "10,2,Gladstone Branch,2" "11,2,Northeast Corridor,2" "12,2,North Jersey Coast Line,2" "13,2,North Jersey Coast Line,2" "14,2,Newark Light Rail,0" "15,2,Pascack Valley Line,2" "16,2,Princeton Shuttle,2" "17,2,Raritan Valley Line,2" "18,2,Meadowlands Rail Line,2"
It appears that if the lines in the csv file are quoted, then macuby acts as expected. So the following csv file works.
"1,2,River LINE,0" "2,2,Princeton Shuttle,0" "3,2,Atlantic City Rail Line,2" "4,2,Montclair-Boonton Line,2" "5,2,Montclair-Boonton Line,2" "6,2,Hudson-Bergen Light Rail,0" "7,2,Main/Bergen County Line,2" "8,2,Port Jervis Line,2" "9,2,Morris & Essex Line,2" "10,2,Gladstone Branch,2" "11,2,Northeast Corridor,2" "12,2,North Jersey Coast Line,2" "13,2,North Jersey Coast Line,2" "14,2,Newark Light Rail,0" "15,2,Pascack Valley Line,2" "16,2,Princeton Shuttle,2" "17,2,Raritan Valley Line,2" "18,2,Meadowlands Rail Line,2"
-- Ticket URL: <http://www.macruby.org/trac/ticket/813#comment:2> MacRuby <http://macruby.org/>
#813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) ------------------------------+--------------------------------------------- Reporter: jadarkwah@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Changes (by martinlagardette@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: This has been fixed in trunk already, I believe with r4114. Using the non- quoted version, I get: {{{ $> macruby csv.rb ["1", "2", "River LINE", "0"] ["2", "2", "Princeton Shuttle", "0"] ["3", "2", "Atlantic City Rail Line", "2"] ["4", "2", "Montclair-Boonton Line", "2"] ["5", "2", "Montclair-Boonton Line", "2"] ["6", "2", "Hudson-Bergen Light Rail", "0"] ["7", "2", "Main/Bergen County Line", "2"] ["8", "2", "Port Jervis Line", "2"] ["9", "2", "Morris & Essex Line", "2"] ["10", "2", "Gladstone Branch", "2"] ["11", "2", "Northeast Corridor", "2"] ["12", "2", "North Jersey Coast Line", "2"] ["13", "2", "North Jersey Coast Line", "2"] ["14", "2", "Newark Light Rail", "0"] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/813#comment:3> MacRuby <http://macruby.org/>
#813: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) ------------------------------+--------------------------------------------- Reporter: jadarkwah@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Description changed by martinlagardette@…: Old description:
'''macruby mrcsv.rb '''
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1799:in `readline' from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1760:in `each' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:5:in `main' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:1:in `<main>'
The following code works with ruby, ruby1.9 and jruby but chokes on macruby.
'''#mrcsv.rb'''
require 'csv'
def main reader = CSV.open("mrtest.csv", "r") reader.each do |row| puts "#{row}" end end
main
'''#mrtest.csv'''
1,2,"River LINE",0
2,2,"Princeton Shuttle",0
3,2,"Atlantic City Rail Line",2
4,2,"Montclair-Boonton Line",2
5,2,"Montclair-Boonton Line",2
6,2,"Hudson-Bergen Light Rail",0
7,2,"Main/Bergen County Line",2
8,2,"Port Jervis Line",2
9,2,"Morris & Essex Line",2
10,2,"Gladstone Branch",2
11,2,"Northeast Corridor",2
12,2,"North Jersey Coast Line",2
13,2,"North Jersey Coast Line",2
14,2,"Newark Light Rail",0
New description: '''macruby mrcsv.rb ''' {{{ /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1817:in `block': Unclosed quoted field on line 1. (CSV::MalformedCSVError) from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1799:in `readline' from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/csv.rb:1760:in `each' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:5:in `main' from /Developer/Projects/NJTransit/rail_data/scripts/./mrservice.rb:1:in `<main>' }}} The following code works with ruby, ruby1.9 and jruby but chokes on macruby. '''#mrcsv.rb''' {{{ #!ruby require 'csv' def main reader = CSV.open("mrtest.csv", "r") reader.each do |row| puts "#{row}" end end main }}} '''#mrtest.csv''' {{{ 1,2,"River LINE",0 2,2,"Princeton Shuttle",0 3,2,"Atlantic City Rail Line",2 4,2,"Montclair-Boonton Line",2 5,2,"Montclair-Boonton Line",2 6,2,"Hudson-Bergen Light Rail",0 7,2,"Main/Bergen County Line",2 8,2,"Port Jervis Line",2 9,2,"Morris & Essex Line",2 10,2,"Gladstone Branch",2 11,2,"Northeast Corridor",2 12,2,"North Jersey Coast Line",2 13,2,"North Jersey Coast Line",2 14,2,"Newark Light Rail",0 }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/813#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby