Re: [Rails] Programmatic way to find the bad spot in a YAML file?

"Phlip" <[email protected]>
Newsgroups gmane.text.yaml.general,gmane.comp.lang.ruby.rails
Message-ID <013a01c7dee7$05de60e0$6801a8c0@Marley>
[CC'd to the YAML-core list]

Scott wrote:

> I have a very large YAML file (approx 5000 entries) that I am loading.
> Somewhere along the way, it doesn't like something in the file so I
> get a :
>
> /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/
> lib/ruby/1.8/yaml.rb:133:in `utc': time out of range (ArgumentError)

> Which is all well and good but it doesn't give me the offending line
> in the YAML file. Anyone write anything out there that helps pinpoint
> where in your YAML file things went south?

I asked this before and got nothing. Syck simply needs a new feature. YAML 
is not useful until its parsing becomes fault-tolerance and introspective.

Workaround: Can you cut your file up into 5000 files of 1 entry each? 
Seriously - to make one file out of them, I would host each segment in 
 >cough< XML.

Also, you could try a JSON parser...

-- 
  Phlip
  http://www.oreilly.com/catalog/9780596510657/
  "Test Driven Ajax (on Rails)"
  assert_xpath, assert_javascript, & assert_ajax 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.