davejacobs/letters

Letters seems to have a problem with Nokogiri & XML objects

Opened this issue · 3 comments

I am not using Bundler to manage my dependencies.

I just have a regular script that has a bunch of requires at the top.

    #!/usr/bin/env ruby

    require 'rubygems'
    require 'nokogiri'
    require 'open-uri'
    require 'date'
    require 'pp'
    require 'cgi'
    require 'letters'

This is the LoadError I keep getting:

 LoadError: no such file to load — letters

 method gem_original_require    in custom_require.rb at line 31
 method require in custom_require.rb at line 31

I also ran gem install letters from the CLI in the folder that my script is, and still no dice.

What am I missing?

Thanks.

Edit 1:

By the way, it seems I have the gem installed properly:

$ gem install letters
 Successfully installed letters-0.3.1
 1 gem installed
 Installing ri documentation for letters-0.3.1...
 Installing RDoc documentation for letters-0.3.1...

Edit 2:

I am wondering if there is a conflict between the letters library and one of those other rubygems, because when I open an IRB in that same folder on the command line and I just do require letters and do run the {foo: "bar"}.o example, it works.

So not sure what's happening here. Maybe an issue with Nokogiri?

Edit 3:

Good news and bad news. It seems that the issue is either with Nokogiri or with the XML objects returned by Nokogiri. Here is the output from trying to parse two different URLs with 1 failing and 1 succeeding.

Fail - https://gist.github.com/e4fead2157c1c9559305#file_letters_xml_parse_fail

Succeed - https://gist.github.com/e4fead2157c1c9559305#file_letters_xml_parse_success

The differences are that the fail was trying to parse this URL: http://www.craigslist.org/about/sites and the one that succeeded parsed this URL: http://sfbay.craigslist.org/cpg/

Does the same thing happen if you load Letters after Nokogiri?

Yep....same thing happens. It seems to be something with the objects returned.

Sorry for the ridiculously delayed reply -- I can't get this to fail on my machine. Has it started working for you, by any chance?