Bugs: Browse | Submit New | Admin

[#27168] Amazon support broken on Ubuntu 9.10 (karmic) - Hpricot issues

Date:
2009-09-23 12:39
Priority:
3
Submitted By:
Martin Dosch (dogge)
Assigned To:
Cathal Mc Ginley (cathalmagus)
Category:
Providers
State:
Open
Summary:
Amazon support broken on Ubuntu 9.10 (karmic) - Hpricot issues

Detailed description
Allthough i registered an account on aws and filled in the id and key i can't use amazon.


978-3-423-21117-8
9783423211178
W, [2009-09-23T18:19:00.645407 #4817]  WARN -- [Cls  Alexandria::BookProviders]: Provider Amazon encountered error:
undefined method `length' for nil:NilClass /usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:49:in `search'
> /usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:100:in `isbn_search'
> /usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialog.rb:392:in `add_single_book_by_isbn'
> /usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialog.rb:387:in `initialize'
> /usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialog.rb:387:in `new'
> /usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialog.rb:387:in `add_single_book_by_isbn'
> /usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialog.rb:500:in `on_add'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `call'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `connect'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `call'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `start_gtk'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:57:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria.rb:40:in `main'
> /usr/bin/alexandria:29

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-11-22 02:21
Sender: Gergely Imreh

Tried the new package, seems to be able to use the Amazon search
alright now.
Date: 2009-11-21 11:29
Sender: Yannick Defais

Hi,

I packaged Hpricot 0.8.1 for Ubuntu Karmic here:
https://launchpad.net/~sevmek/+archive/education

Using the above repository fixed the issue for me.

I used the Debian Squeeze package and rebuilded it for Karmic
(no changes).

Best regards,
Yannick
Date: 2009-09-30 22:00
Sender: Cathal Mc Ginley

Confirmed with the original reporter that upgrading to Hpricot
1.8.1 will resolve this issue. Users on Ubuntu can probably grab
the latest 1.8.1 deb from Debian; I'll have to request that Ubuntu
sync to that version.

On other systems, you can install the hpricot gem and remove
any native Hpricot package of the wrong version.
Date: 2009-09-29 13:12
Sender: Cathal Mc Ginley

I've installed the alpha-6 release of Xubuntu 9.10 (karmic) and
found that the installed libhpricot-ruby (1.8-2) causes the problems
as described. Alexandria failed to find any books at Amazon.
The attached hpricot_test.rb (written to diagnose the parsing
issues) fails to run fully.

So I removed the deb package (and the alexandria package along
with it) and installed rubygems & ruby-dev - then installed
the hpricot gem (version 1.8.1). The test script worked
as expected.

Next, I installed subversion, rake and intltool - then downloaded
the latest Alexandria SVN and installed it with 'sudo rake install'
- and Amazon support was working again!

[By the way, just installing the hpricot gem and then trying
to use the alexandria deb won't work, as it will still require
libhpricot-ruby and will pull in the broken version. The proper
solution will of course be to fix libhpricot-ruby!]

So I suppose I should check that Ubuntu has this noted as a bug,
and see if I can get them to sneak in the upgrade before the
9.10 release.
Date: 2009-09-24 13:21
Sender: Martin Dosch

Ok, I had to replace the line manually, but it still doesn't
work.
i attach the log.
Date: 2009-09-24 12:51
Sender: Cathal Mc Ginley

Oh, did I mention you need to have applied the hpricot-xml.diff
patch first, and then inexact-match.diff

Anyway, if it still doesn't work, it's a simple enough change
to apply manually.
sudo gedit /usr/local/lib/site_ruby/1.8/alexandria/book_providers
/amazon_aws.rb

Around line 153, where the line begins "next unless"...
replace that line with these two lines

log.info {"ProductGroup =
#{item.get('ItemAttributes/ProductGroup')}"}
next unless item.get('ItemAttributes/ProductGroup') =~ /Book/i
Date: 2009-09-24 12:42
Sender: Martin Dosch

i cant use the latest patch :(

$ patch -p1 < /home/martin/Downloads/inexact-match.diff 
patching file lib/alexandria/book_providers/amazon_aws.rb
Hunk #1 FAILED at 150.
1 out of 1 hunk FAILED -- saving rejects to file
lib/alexandria/book_providers/amazon_aws.rb.rej
Date: 2009-09-24 12:26
Sender: Cathal Mc Ginley

Here's another patch to apply on top of the last changes:
inexact-match.diff

It's a very simple change, which might explain why Hpricot is
still failing to match elements.
Date: 2009-09-24 07:52
Sender: Martin Dosch

it still doesn't work.
i added you in jabber, but i'm typing slowly cause i have a
injury at my right hand 

log after patching and reinstalling:

$ LOGLEVEL=INFO alexandria
I, [2009-09-24T13:48:52.482834 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Barnes and Noble
(provider not functional)
I, [2009-09-24T13:48:52.531478 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Thalia (provider not
functional)
I, [2009-09-24T13:48:52.531615 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading IBS (provider not
functional)
I, [2009-09-24T13:48:52.531707 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Renaud (provider not
functional)
I, [2009-09-24T13:48:52.531792 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading BOL (provider not
functional)
I, [2009-09-24T13:48:52.531874 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Webster (provider
not functional)
I, [2009-09-24T13:48:52.607959 #15331]  INFO -- [Cls 
Alexandria::BookProviders]: Can't load Ruby/ZOOM, hence
Z39.50 and providers Library of Congress, British Library
not available
W, [2009-09-24T13:48:52.916419 #15331]  WARN -- : Unable to
open the Evolution address book: EBookStatus returned 20
I, [2009-09-24T13:48:52.983137 #15331]  INFO -- [Mod
Alexandria::UI]: Initializing app_datadir...
I, [2009-09-24T13:48:52.990818 #15331]  INFO -- [Mod
Alexandria::UI]: Initializing Icons...
I, [2009-09-24T13:48:52.999202 #15331]  INFO -- [Mod
Alexandria::UI]: Starting MainApp...
I, [2009-09-24T13:48:52.999364 #15331]  INFO -- <Obj
Alexandria::UI::MainApp>: Starting MainApp
I, [2009-09-24T13:48:53.540931 #15331]  INFO -- <Obj
Alexandria::UI::UIManager>: Loading Libraries...
I, [2009-09-24T13:48:53.699812 #15331]  INFO -- <Obj
Alexandria::UI::ListViewManager>: setup_view_source_dnd for
#<Gtk::TreeView:0xb6ff3820>
I, [2009-09-24T13:48:53.702206 #15331]  INFO -- <Obj
Alexandria::UI::IconViewManager>: setup_books_iconview
#<Gtk::TreeModelSort:0xb6fbdf18 ptr=0x9d8cf28>
I, [2009-09-24T13:48:53.702530 #15331]  INFO -- <Obj
Alexandria::UI::IconViewManager>: now @iconview.model =
#<Gtk::TreeModelSort:0xb6fbdf18 ptr=0x9d8cf28>
I, [2009-09-24T13:48:53.703765 #15331]  INFO -- <Obj
Alexandria::UI::IconViewManager>: setup_view_source_dnd for
#<Gtk::IconView:0xb6ff3bb8>
I, [2009-09-24T13:48:53.781327 #15331]  INFO -- [Mod
Alexandria::UI]: Starting Gtk...
I, [2009-09-24T13:48:57.635042 #15331]  INFO -- <Obj
Alexandria::UI::UIManager>: on_add_book
I, [2009-09-24T13:48:57.662504 #15331]  INFO -- <Obj
Alexandria::UI::NewBookDialog>: New Book Dialog
3446228810
9783446228818
I, [2009-09-24T13:49:00.445167 #15331]  INFO -- <Obj
Alexandria::UI::NewBookDialog>: New @find_thread
#<Thread:0xb6fab084>
I, [2009-09-24T13:49:00.446688 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Amazon search
for 3446228810 / type-0
I, [2009-09-24T13:49:00.447177 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Key ID
AKIAI3BKO5UVU7NGPQDA
I, [2009-09-24T13:49:00.447706 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Secret whfCUW
... 6ViAx6
I, [2009-09-24T13:49:00.448406 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Requesting from
de
I, [2009-09-24T13:49:03.236936 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Got products
[#<Amazon::Element:0xb6f9fab8 @element={elem <Item>
{elem
<ASIN> "3446228810" </ASIN>} {elem
<DetailPageURL>
"http://www.amazon.de/Taschenbuch-Mechatronik-Ekbert-Hering/
dp/3446228810%3FSubscriptionId%3DAKIAI3BKO5UVU7NGPQDA%26tag%3Dws%
26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN
%3D3446228810"
{bogusetag </DetailPageURL>} {elem <SmallImage> {elem
<URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL75_.jp
g"
</URL>} {elem <Height Units="pixels">
"75" {bogusetag
</Height>} {elem <Width Units="pixels">
"51" {bogusetag
</Width>}}} </SmallImage>} {elem <MediumImage>
{elem <URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL160_.j
pg"
</URL>} {elem <Height Units="pixels">
"160" {bogusetag
</Height>} {elem <Width Units="pixels">
"108" {bogusetag
</Width>}}} </MediumImage>} {elem <LargeImage>
{elem <URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L.jpg"
</URL>} {elem <Height Units="pixels">
"180" {bogusetag
</Height>} {elem <Width Units="pixels">
"122" {bogusetag
</Width>} {bogusetag </LargeImage>} {elem
<ImageSets> {elem
<ImageSet Category="primary"> {elem
<SwatchImage> {elem
<URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL30_.jp
g"
</URL>} {elem <Height Units="pixels">
"30" {bogusetag
</Height>} {elem <Width Units="pixels">
"20" {bogusetag
</Width>}}} </SwatchImage>} {elem <SmallImage>
{elem <URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL75_.jp
g"
</URL>} {elem <Height Units="pixels">
"75" {bogusetag
</Height>} {elem <Width Units="pixels">
"51" {bogusetag
</Width>}}} </SmallImage>} {elem <MediumImage>
{elem <URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL160_.j
pg"
</URL>} {elem <Height Units="pixels">
"160" {bogusetag
</Height>} {elem <Width Units="pixels">
"108" {bogusetag
</Width>}}} </MediumImage>} {elem <LargeImage>
{elem <URL>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L.jpg"
</URL>} {elem <Height Units="pixels">
"180" {bogusetag
</Height>} {elem <Width Units="pixels">
"122" {bogusetag
</Width>} {bogusetag </LargeImage>}}}}
</ImageSet>}
</ImageSets>} {elem <ItemAttributes> {elem
<Binding>
"Gebundene Ausgabe" </Binding>} {elem
<Creator
Role="Herausgeber"> "Ekbert Hering" {bogusetag
</Creator>}
{elem <Creator Role="Herausgeber"> "Heinrich
Steinhart"
{bogusetag </Creator>} {elem <EAN>
"9783446228818" </EAN>}
{elem <Edition> "1., Aufl." {bogusetag
</Edition>} {elem
<ISBN> "3446228810" {bogusetag </ISBN>}
{elem <Label>
"Hanser Fachbuchverlag" </Label>} {elem
<Languages> {elem
<Language> {elem <Name> "Deutsch" {bogusetag
</Name>} {elem
<Type> "Original Language" {bogusetag
</Type>}}}
</Language>} {elem <Language> {elem <Name>
"Deutsch"
{bogusetag </Name>} {elem <Type> "Unknown"
{bogusetag
</Type>}}} </Language>} {elem <Language> {elem
<Name>
"Deutsch" {bogusetag </Name>} {elem <Type>
"Published"
{bogusetag </Type>}}} </Language>} {bogusetag
</Languages>}
{elem <ListPrice> {elem <Amount> "2990"
</Amount>} {elem
<CurrencyCode> "EUR" {bogusetag </CurrencyCode>}
{elem
<FormattedPrice> "EUR 29,90" {bogusetag
</FormattedPrice>}}}
</ListPrice>} {elem <Manufacturer> "Hanser
Fachbuchverlag"
{bogusetag </Manufacturer>} {elem <NumberOfPages>
"504"
</NumberOfPages>} {elem <PackageDimensions> {elem
<Height
Units="hundredths-inches"> "126" {bogusetag
</Height>} {elem
<Length Units="hundredths-inches"> "740"
{bogusetag
</Length>} {elem <Weight
Units="hundredths-pounds"> "132"
{bogusetag </Weight>} {elem <Width
Units="hundredths-inches"> "520" {bogusetag
</Width>}
{bogusetag </PackageDimensions>} {elem <ProductGroup>
"Book"
{bogusetag </ProductGroup>} {elem <PublicationDate>
"2005-01-13" </PublicationDate>} {elem
<Publisher> "Hanser
Fachbuchverlag" </Publisher>} {elem <Studio>
"Hanser
Fachbuchverlag" {bogusetag </Studio>} {elem
<Title>
"Taschenbuch der Mechatronik" {bogusetag
</Title>}
{bogusetag </ItemAttributes>} {bogusetag </Item>}
{bogusetag
</Items>} {bogusetag
</ItemSearchResponse>}}}}}}}}}}}}}}}}}}}}}>]
I, [2009-09-24T13:49:03.238164 #15331]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: About to return
[] / type-0
W, [2009-09-24T13:49:03.738682 #15331]  WARN -- [Cls 
Alexandria::BookProviders]: Provider Amazon encountered
error: undefined method `length' for nil:NilClass
/usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:49:in
`search'
>
/usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:100:in
`isbn_search'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:392:in
`add_single_book_by_isbn'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`initialize'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`new'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`add_single_book_by_isbn'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:500:in
`on_add'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `call'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `connect'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `call'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in
`start_gtk'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:57:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria.rb:40:in `main'
> /usr/bin/alexandria:29
I, [2009-09-24T13:49:06.010049 #15331]  INFO -- <Obj
Alexandria::BookProviders::AdLibrisProvider>: Fetching
http://www.adlibris.com/se/product.aspx?isbn=3446228810 
http://www.worldcat.org/search?q=isbn%3A9783446228818&qt=adva
nced
Net::HTTPOK
W, [2009-09-24T13:49:30.007141 #15331]  WARN -- <Obj
Alexandria::BookProviders::WorldCatProvider>: Unexpected
lack of title from WorldCat lookup
W, [2009-09-24T13:49:32.471403 #15331]  WARN -- [Cls 
Alexandria::BookProviders]: Error while searching 3446228810
Date: 2009-09-23 19:06
Sender: Cathal Mc Ginley

I don't know why Hpricot is working differently for you, but
it seems that it is (those 'bogusetags' are still there in your
latest debug log).

I've attached a new patch (hpricot-xml.diff) which you should
apply to a newly-unpacked alexandria-0.6.5 in the same way as
the previous patch, and then re-install. This might fix Hpricot's
parsing troubles.

I have one or two more things to try before I give up. If you
were on some kind of IM system it might make the turn-around
a bit quicker. You can reach me on XMPP/Jabber via
gnostai@gmail.com
Date: 2009-09-23 17:38
Sender: Martin Dosch

Ok, now I have installed libhpricot 0.8.1 but the error
still occurs. :(

$ LOGLEVEL=INFO alexandria
I, [2009-09-23T23:35:25.518767 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Barnes and Noble
(provider not functional)
I, [2009-09-23T23:35:25.559920 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Thalia (provider not
functional)
I, [2009-09-23T23:35:25.560064 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading IBS (provider not
functional)
I, [2009-09-23T23:35:25.560150 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Renaud (provider not
functional)
I, [2009-09-23T23:35:25.560233 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading BOL (provider not
functional)
I, [2009-09-23T23:35:25.560316 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Not loading Webster (provider
not functional)
I, [2009-09-23T23:35:25.656715 #25860]  INFO -- [Cls 
Alexandria::BookProviders]: Can't load Ruby/ZOOM, hence
Z39.50 and providers Library of Congress, British Library
not available
W, [2009-09-23T23:35:26.520867 #25860]  WARN -- : Unable to
open the Evolution address book: EBookStatus returned 20
I, [2009-09-23T23:35:26.622421 #25860]  INFO -- [Mod
Alexandria::UI]: Initializing app_datadir...
I, [2009-09-23T23:35:26.814709 #25860]  INFO -- [Mod
Alexandria::UI]: Initializing Icons...
I, [2009-09-23T23:35:26.823317 #25860]  INFO -- [Mod
Alexandria::UI]: Starting MainApp...
I, [2009-09-23T23:35:26.823492 #25860]  INFO -- <Obj
Alexandria::UI::MainApp>: Starting MainApp
I, [2009-09-23T23:35:27.763655 #25860]  INFO -- <Obj
Alexandria::UI::UIManager>: Loading Libraries...
I, [2009-09-23T23:35:27.995837 #25860]  INFO -- <Obj
Alexandria::UI::ListViewManager>: setup_view_source_dnd for
#<Gtk::TreeView:0xb70b07b8>
I, [2009-09-23T23:35:27.998306 #25860]  INFO -- <Obj
Alexandria::UI::IconViewManager>: setup_books_iconview
#<Gtk::TreeModelSort:0xb707aeb0 ptr=0x8b68f28>
I, [2009-09-23T23:35:27.998675 #25860]  INFO -- <Obj
Alexandria::UI::IconViewManager>: now @iconview.model =
#<Gtk::TreeModelSort:0xb707aeb0 ptr=0x8b68f28>
I, [2009-09-23T23:35:28.000021 #25860]  INFO -- <Obj
Alexandria::UI::IconViewManager>: setup_view_source_dnd for
#<Gtk::IconView:0xb70b0b50>
I, [2009-09-23T23:35:28.078787 #25860]  INFO -- [Mod
Alexandria::UI]: Starting Gtk...
I, [2009-09-23T23:36:29.324930 #25860]  INFO -- <Obj
Alexandria::UI::UIManager>: on_add_book
I, [2009-09-23T23:36:29.353783 #25860]  INFO -- <Obj
Alexandria::UI::NewBookDialog>: New Book Dialog
9783446228818
9783446228818
I, [2009-09-23T23:36:49.068979 #25860]  INFO -- <Obj
Alexandria::UI::NewBookDialog>: New @find_thread
#<Thread:0xb7062e28>
I, [2009-09-23T23:36:49.153153 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Amazon search
for 3446228810 / type-0
I, [2009-09-23T23:36:49.153440 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Key ID
AKIAI3BKO5UVU7NGPQDA
I, [2009-09-23T23:36:49.153639 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Secret whfCUW
... 6ViAx6
I, [2009-09-23T23:36:49.154181 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Requesting from
de
I, [2009-09-23T23:36:51.778413 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: Got products
[#<Amazon::Element:0xb7056f4c @element={elem <item>
{elem
<asin> "3446228810" </ASIN>} {elem
<detailpageurl>
"http://www.amazon.de/Taschenbuch-Mechatronik-Ekbert-Hering/
dp/3446228810%3FSubscriptionId%3DAKIAI3BKO5UVU7NGPQDA%26tag%3Dws%
26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN
%3D3446228810"
</DetailPageURL>} {elem <smallimage> {elem
<url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL75_.jp
g"
</URL>} {elem <height Units="pixels">
"75" </Height>} {elem
<width Units="pixels"> "51" </Width>}
</SmallImage>} {elem
<mediumimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL160_.j
pg"
</URL>} {elem <height Units="pixels">
"160" </Height>} {elem
<width Units="pixels"> "108" </Width>}
</MediumImage>} {elem
<largeimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L.jpg"
</URL>} {elem <height Units="pixels">
"180" </Height>} {elem
<width Units="pixels"> "122" </Width>}
</LargeImage>} {elem
<imagesets> {elem <imageset Category="primary">
{elem
<swatchimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL30_.jp
g"
</URL>} {elem <height Units="pixels">
"30" </Height>} {elem
<width Units="pixels"> "20" </Width>}
</SwatchImage>} {elem
<smallimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL75_.jp
g"
</URL>} {elem <height Units="pixels">
"75" </Height>} {elem
<width Units="pixels"> "51" </Width>}
</SmallImage>} {elem
<mediumimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L._SL160_.j
pg"
</URL>} {elem <height Units="pixels">
"160" </Height>} {elem
<width Units="pixels"> "108" </Width>}
</MediumImage>} {elem
<largeimage> {elem <url>
"http://ecx.images-amazon.com/images/I/21TNJ8Q2K8L.jpg"
</URL>} {elem <height Units="pixels">
"180" </Height>} {elem
<width Units="pixels"> "122" </Width>}
</LargeImage>}
{bogusetag </ImageSet>}} </ImageSets>} {elem
<itemattributes> {elem <binding> "Gebundene
Ausgabe"
{bogusetag </Binding>} {elem <creator
Role="Herausgeber">
"Ekbert Hering" {bogusetag </Creator>} {elem
<creator
Role="Herausgeber"> "Heinrich Steinhart"
{bogusetag
</Creator>} {elem <ean> "9783446228818"
</EAN>} {elem
<edition> "1., Aufl." {bogusetag </Edition>}
{elem <isbn>
"3446228810" {bogusetag </ISBN>} {elem <label>
"Hanser
Fachbuchverlag" {bogusetag </Label>} {elem
<languages> {elem
<language> {elem <name> "Deutsch" </Name>}
{elem <type>
"Original Language" {bogusetag </Type>}
{bogusetag
</Language>} {elem <language> {elem <name>
"Deutsch"
</Name>} {elem <type> "Unknown" {bogusetag
</Type>}
{bogusetag </Language>} {elem <language> {elem
<name>
"Deutsch" </Name>} {elem <type>
"Published" {bogusetag
</Type>} {bogusetag </Language>} {bogusetag
</Languages>}
{elem <listprice> {elem <amount> "2990"
{bogusetag
</Amount>} {elem <currencycode> "EUR"
</CurrencyCode>} {elem
<formattedprice> "EUR 29,90" {bogusetag
</FormattedPrice>}}}
</ListPrice>} {elem <manufacturer> "Hanser
Fachbuchverlag"
</Manufacturer>} {elem <numberofpages> "504"
{bogusetag
</NumberOfPages>} {elem <packagedimensions> {elem
<height
Units="hundredths-inches"> "126"
</Height>} {elem <length
Units="hundredths-inches"> "740" {bogusetag
</Length>} {elem
<weight Units="hundredths-pounds"> "132"
{bogusetag
</Weight>} {elem <width
Units="hundredths-inches"> "520"
</Width>}}} </PackageDimensions>} {elem
<productgroup>
"Book" {bogusetag </ProductGroup>} {elem
<publicationdate>
"2005-01-13" </PublicationDate>} {elem
<publisher> "Hanser
Fachbuchverlag" </Publisher>} {elem <studio>
"Hanser
Fachbuchverlag" </Studio>} {elem <title>
"Taschenbuch der
Mechatronik" </Title>}}}}}}}}}}}}}}}}
</ItemAttributes>}
{bogusetag </Item>}}>]
I, [2009-09-23T23:36:51.779680 #25860]  INFO -- <Obj
Alexandria::BookProviders::AmazonProvider>: About to return
[] / type-0
W, [2009-09-23T23:36:52.302692 #25860]  WARN -- [Cls 
Alexandria::BookProviders]: Provider Amazon encountered
error: undefined method `length' for nil:NilClass
/usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:49:in
`search'
>
/usr/local/lib/site_ruby/1.8/alexandria/book_providers.rb:100:in
`isbn_search'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:392:in
`add_single_book_by_isbn'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`initialize'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`new'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:387:in
`add_single_book_by_isbn'
>
/usr/local/lib/site_ruby/1.8/alexandria/ui/dialogs/new_book_dialo
g.rb:500:in
`on_add'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `call'
> /usr/lib/ruby/1.8/libglade2.rb:45:in `connect'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `call'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:51:in
`start_gtk'
> /usr/local/lib/site_ruby/1.8/alexandria/ui.rb:57:in `main'
> /usr/local/lib/site_ruby/1.8/alexandria.rb:40:in `main'
> /usr/bin/alexandria:29
I, [2009-09-23T23:36:53.619108 #25860]  INFO -- <Obj
Alexandria::BookProviders::AdLibrisProvider>: Fetching
http://www.adlibris.com/se/product.aspx?isbn=3446228810 
Date: 2009-09-23 16:56
Sender: Cathal Mc Ginley

Oops, I keep forgetting that I'm on a source-based distro, so
I already have all the dev files.

You need to install the ruby1.8-dev package, that'll give you
mkmf.

[ Note: the version of libhpricot-ruby is 0.8-2 not 0.8.2  ...
this means it's probably the source of 0.8.0 but the second deb
file release - what the gem file will give you is 0.8.1 with
extra bug fixes (hopefully!) ]
Date: 2009-09-23 16:15
Sender: Martin Dosch

Yes, there was libhpricot-ruby 0.8.2 was installed.
I removed Version 0.8.2 but installing 0.8.1 failed.

$ sudo gem install hpricot
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
	ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf
(LoadError)
	from extconf.rb:1


Gem files will remain installed in
/var/lib/gems/1.8/gems/hpricot-0.8.1 for inspection.
Results logged to
/var/lib/gems/1.8/gems/hpricot-0.8.1/ext/hpricot_scan/gem_make.ou
t


And Version 0.8.2 is the only available version in the
karmic sources. :( 
Date: 2009-09-23 15:57
Sender: Cathal Mc Ginley

Hm. This might be due to Hpricot (the HTML/XML parser used in
the Amazon provider). What version of libhpricot-ruby do you
have installed? (Ubuntu Karmic seems to have 0.8-2 according
to a quick search.) Perhaps try uninstalling it, and instead
installing rubygems and grabbing the hpricot gem (which should
be 0.8.1) with:

  sudo gem install hpricot

I think I'll have to improve the Amazon provider by getting rid
of the file amazon_ecs.rb anyway and using my own Hpricot code
(from Palatina).

[ Explanation (for my reference): I noticed a difference between
my Hpricot objects:
{elem <productgroup> "Book"
</productgroup>}
and yours:
{elem <productgroup> "Book" {bogusetag
</ProductGroup>}
which suggests our versions of Hpricot must differ somehow. Then
I looked and saw that line 153 of amazon_aws.rb:
next unless item.get('itemattributes/productgroup') == 'Book'
will indeed skip all products and end up with an empty list if
the Hpricot code fails to match. For ISBN searches, this will
try to return the first element of an empty list, which is defined
as nil. This matches the errors you're getting. ]
Date: 2009-09-23 15:14
Sender: Martin Dosch

Alright, I hope this output will be useful to find the bug.
Date: 2009-09-23 14:58
Sender: Cathal Mc Ginley

Okay, I've created and attached a simple patch which adds lots
of logging statements to the Amazon search method. Download the
patch, then open a terminal to wherever you have the source for
alexandria unpacked. Apply the patch:

  patch -p1 < ~/alexandria-amazon-logging.diff

(possibly alter this, depending where you saved the patch) and
re-install alexandria with:

  sudo rake install

Then run the program from a terminal, first setting the
log level:

  LOGLEVEL=INFO alexandria

You should be able to pick out lots of INFO level logs relating
to Amazon. Attach them here, or e-mail me cathal.magus@gnostai.org
With luck I might be able to see why problems are arising.
Date: 2009-09-23 13:36
Sender: Martin Dosch

I had this error when using the *.deb on xubuntu 9.10 alpha too.
I'm not into ruby, i'm only a little bit experienced in
c-programming.
I will try to help you if you tell me what i have to do.
Date: 2009-09-23 13:26
Sender: Cathal Mc Ginley

This is odd, people have been having issues with the Amazon provider
in Alexandria 0.6.5 which I'm unable to reproduce.

In your case it's even stranger. The cause of the error is that
the method 'search' in the Amazon provider is returning nil,
but I can't see why, the code in amazon_aws.rb doesn't *seem*
to allow this case. If there are no results found, an expected
NoResultsError would be raised.

I can see you're installed Alexandria from the source tarball.
What level of technical experience do you have? Could I ask you
to insert logging statements into the Amazon provider code to
help me diagnose the problem? (since I can't duplicate the problem
locally).

Attached Files:

Name Description Download
hpricot_test.rb Script to test the functioning of Hpricot Download
log.txt Download
inexact-match.diff Check why not matching on == "Book", try regex match Download
hpricot-xml.diff Make Amazon use Hpricot.XML for parsing Download
amazon-log.txt Download
alexandria-amazon-logging.diff Patch to add lots of logging output to Amazon provider Download

Changes:

Field Old Value Date By
artifact_group_idNone2009-09-30 22:00cathalmagus
resolution_idNone2009-09-30 22:00cathalmagus
File Added4751: hpricot_test.rb2009-09-29 13:12cathalmagus
summaryamazon doesn't work2009-09-29 13:12cathalmagus
File Added4745: log.txt2009-09-24 13:22dogge
File Added4744: inexact-match.diff2009-09-24 12:26cathalmagus
File Added4742: hpricot-xml.diff2009-09-23 19:06cathalmagus
File Added4741: amazon-log.txt2009-09-23 15:14dogge
File Added4740: alexandria-amazon-logging.diff2009-09-23 14:58cathalmagus
assigned_tonone2009-09-23 14:58cathalmagus