# Fastercsv error

**URL:** <https://www.ruby-forum.com/t/fastercsv-error/122459>\
**Category:** Ruby\
**Created:** [December 7, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/fastercsv-error/122459 "2007-12-07T19:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 7, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/fastercsv-error/122459/1 "2007-12-07T19:31:05Z")

</div>

When i try to parse this file, i get a error.

irb(main):006:0\> rows=FasterCSV.new(“c:\temp\mktsymbols.txt”,  
{:headers=\>true,:  
col\_sep=\>"\t"})  
=\> #\<FasterCSV:0x2ddfc3c @lineno=0, @header\_converters=[],  
@converters=[], @unco  
nverted\_fields=nil, @parsers={:line\_end=\>/\n\z/, :leading\_fields=\>/  
\A(?:\t)+/, :  
csv\_row=\>/ \G(?:^|\t) # anchor the match  
(?: “( (?\>[^”]_) # find quoted fields  
(?\> “”  
[^"]_ )\* )"  
| # … or …  
([^"\t]\*) # unquoted fields  
)/x}, @row\_sep="\n", @return\_headers=false,  
@headers=nil, @col\_sep  
="\t", @use\_headers=true, @skip\_blanks=false, @io=#\<StringIO:  
0x2ddfc00\>, @quote=  
#\<Proc:0x02e05f90@e:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.1/lib/  
faster\_csv.  
rb:1665\>, @quote\_char="""\>

the file contents are  
SYMBOL DESCRIPTION EXCHANGE  
EDS RX EDS JUN 2008 P 22.500 OPRA  
EDS RY EDS JUN 2008 P 27.500 OPRA  
EDS RZ EDS JUN 2008 P 32.500 OPRA  
EDS XD EDS DEC 2007 P 20.000 OPRA  
EDS XE EDS DEC 2007 P 25.000 OPRA  
EDS XF EDS DEC 2007 P 30.000 OPRA  
EDS XG EDS DEC 2007 P 35.000 OPRA  
EDS XH EDS DEC 2007 P 40.000 OPRA  
EDS XT EDS DEC 2007 P 17.500 OPRA  
EDS XU EDS DEC 2007 P 37.500 OPRA  
EDS XX EDS DEC 2007 P 22.500 OPRA  
EDS XY EDS DEC 2007 P 27.500 OPRA  
EDS XZ EDS DEC 2007 P 32.500 OPRA  
EDS1CN07 EDS JUL 2007 ONECH  
EDS1CQ07 EDS AUG 2007 ONECH  
EDS1CU07 EDS SEP 2007 ONECH  
EDS1CZ07 EDS DEC 2007 ONECH  
EDSAX EVERGREEN DISCIPLINED VALUE FUND CLASS NASDAQ  
EDSBX EVERGREEN DISCIPLINED VALUE FUND CLASS NASDAQ  
EDSCX EVERGREEN DISCIPLINED VALUE FUND CLASS NASDAQ  
EDSI EDUCATIONAL SERVICES OTC  
EDSIX EVERGREEN DISCIPLINED VALUE FUND INSTI NASDAQ  
EDTA E-DATA CORPORATION OTC  
EDTDF ENEA AB OTC  
EDTXX EVERGREEN INSTI TREASURY MONEY MARKET F NASDAQ

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 7, 2007, 9:26pm UTC](https://www.ruby-forum.com/t/fastercsv-error/122459/2 "2007-12-07T21:26:04Z")

</div>

On Dec 7, 2007, at 12:30 PM, Junkone wrote:

> When i try to parse this file, i get a error.

Can you show the error please?

James Edward G. II

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 7, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/fastercsv-error/122459/3 "2007-12-07T21:55:26Z")

</div>

On Dec 7, 3:24 pm, James G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Dec 7, 2007, at 12:30 PM, Junkone wrote:
> 
> > When i try to parse this file, i get a error.
> 
> Can you show the error please?
> 
> James Edward G. II

when i try to print the row, it returns nil. pl see below. it means  
that this tool could not parse the data.  
irb(main):045:0\> rows=FasterCSV.new(“c:\temp\mktsymbols.txt”,  
{:headers=\>true,:  
col\_sep=\>“\t”})  
=\> #\<FasterCSV:0x2e38378 @lineno=0, @header\_converters=[],  
@converters=[], @unco  
nverted\_fields=nil, @parsers={:line\_end=\>/\n\z/, :leading\_fields=\>/  
\A(?:\t)+/, :  
csv\_row=\>/ \G(?:^|\t) # anchor the match  
(?: “( (?\>[^”]_) # find quoted fields  
(?\> “”  
[^"]_ )\* )"  
| # … or …  
([^“\t]\*) # unquoted fields  
)/x}, @row\_sep=”\n", @return\_headers=false,  
@headers=nil, @col\_sep  
=“\t”, @use\_headers=true, @skip\_blanks=false, @io=#\<StringIO:  
0x2e3833c\>, @quote=  
#\<Proc:0x02e05f90@e:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.1/lib/  
faster\_csv.  
rb:1665\>, @quote\_char=“"”\>

irb(main):047:0\> rows.each{|r| puts “row found”}  
=\> nil  
irb(main):047:0\>

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 7, 2007, 10:10pm UTC](https://www.ruby-forum.com/t/fastercsv-error/122459/4 "2007-12-07T22:10:40Z")

</div>

On Dec 7, 2007, at 2:54 PM, Junkone wrote:

> when i try to print the row, it returns nil. pl see below. it means  
> that this tool could not parse the data.

The “nil” returned is the return value of your puts() call, shown by  
IRb.

The issue is that you are using FasterCSV.new(). It’s intended for  
when you want to pass in your own IO-like object. You are passing in  
the path of a file to open though, so you want FasterCSV.open().

James Edward G. II
