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) from /Applications/Locomotive2/Bundles/ standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in `node_import'' from /Applications/Locomotive2/Bundles/ standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in `load'' from /Applications/Locomotive2/Bundles/ standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in `load'' 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? Thanks, Scott --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Phlip
2007-Aug-15 02:50 UTC
Re: [Rails] Programmatic way to find the bad spot in a YAML file?
[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/
Clark C. Evans
2007-Aug-15 15:48 UTC
Re: [Yaml-core] [Rails] Programmatic way to find the bad spot in a YAML file?
There is another "C" version of YAML which is quite fast and gives very good exception reporting, at http://pyyaml.org/wiki/LibYAML, perhaps it needs a ruby binding? For a pure ruby solution, see http://rbyaml.rubyforge.org/ it should also have better error reporting than syck. On Tue, Aug 14, 2007 at 07:50:19PM -0700, Phlip wrote: | 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. On Tue, Aug 14, 2007 at 08:34:38PM -0700, Phlip wrote: | The outer problem is fault tolerance. Our programs can only be as | user-friendly and fault-tolerant as their libraries. The lower the library, | the more tolerance. I can''t ask my customers to enter all their data in YAML | until I can highlight the line and column of their errors for them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---