view · edit · sidebar · attach · print · history

20130218-debug-oddb2xml-with-ruby187

<< | Index | >>


Summary

  • debug oddb2xml with various ruby-1.8.7 Installation.

Commits

Index


* Debug-oddb2xml-with-ruby-187

$ oddb2xml -a nonpharma -o fi
WARNING: Nokogiri was built against LibXML version 2.7.8, but has
dynamically loaded 2.8.0
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
/usr/local/lib64/ruby/gems/1.8/gems/oddb2xml-1.4.1/lib/oddb2xml/downloader.rb:247:in
`init': undefined method `ignore_bad_chunking=' for
#<Mechanize:0x7fc01f194178> (NoMethodError)
        from /usr/local/lib64/ruby/gems/1.8/gems/net-http-persistent-2.8/lib/net/http/faster.rb:15:in
`join'
        from /usr/local/lib64/ruby/gems/1.8/gems/net-http-persistent-2.8/lib/net/http/faster.rb:15:in
`to_proc'
        from /usr/local/lib64/ruby/gems/1.8/gems/oddb2xml-1.4.1/lib/oddb2xml/cli.rb:67:in
`map'
        from /usr/local/lib64/ruby/gems/1.8/gems/oddb2xml-1.4.1/lib/oddb2xml/cli.rb:67:in
`run'
        from /usr/local/lib64/ruby/gems/1.8/gems/oddb2xml-1.4.1/bin/oddb2xml:68
        from /usr/local/bin/oddb2xml:19:in `load'
        from /usr/local/bin/oddb2xml:19

This problems come from following reasons.

  • LibXML is old. (Nokogiri use LibXML, Nokogiri is also old.)
  • Mechanize is old.

This problem is caused on System that has already Nokogiri and Mechanize are installed.

Ref.

Update to use mechanize 2.5.1 (force)

  • mechanize (2.5.1 has ruby 1.8.7 support.)
    • nokogiri (1.4)

Note.

Mechanize 2.5.1 has following Runtime dependencies.

    domain_name >= 0.5.1, ~> 0.5
    mime-types >= 1.17.2, ~> 1.17
    net-http-digest_auth >= 1.1.1, ~> 1.1
    net-http-persistent >= 2.5.2, ~> 2.5
    nokogiri ~> 1.4
    ntlm-http >= 0.1.1, ~> 0.1
    webrobots >= 0.0.9, ~> 0.0
commit

Checked options on ruby 1.8.7

$ oddb2xml
$ oddb2xml -o fi
$ oddb2xml -a nonpharma
$ oddb2xml -x addr
$ oddb2xml -f dat
$ oddb2xml -a nonpharma -f dat
$ oddb2xml -a nonpharma -f dat
/path/to/oddb2xml/lib/oddb2xml/builder.rb:849:in `format_price': undefined method `chr' for "810":String (NoMethodError)
        from /path/to/oddb2xml/lib/oddb2xml/builder.rb:911:in `build_dat'
        from /path/to/gems/ruby/1.8/gems/spreadsheet-0.7.9/lib/spreadsheet/excel/reader.rb:1194:in `each_with_index'
        ...
commit

white space in dat file.

...
1111566933GLIBESIFAR Tabl 5 mg 100 Stk                      000965001925100B070620076805226902432
1111140105UBICHINON COMPOSITUM Heel Inj Lös 100 Amp 2.2 ml 0000000000003000000000076401434458062
1112161486NOVONORM Tabl 1 mg 90 Stk                         001945003875100B070620076805457103862
1111955511FRAXIFORTE 0.6 ml Inj Lös 10 Fertspr 0.6 ml      012205015650100B060330076805449901922
1112298630SANUKEHL Myc Inj Lös D 5 10 Amp 1 ml             0000000000003000000000076805306402782
1114615023PALLADON Inject Inj Lös 10 mg/ml 5 Amp 1 ml      0000000000003030000000076805922500332
1111233539TEMESTA Expidet Tabl 1 mg 50 Stk                  000757001685103B010410076804710208182
1114880009ALLERGOVIT Mix Gramin/Betula/Secale Kombi 2 x 3 ml030790036985100A071330076806062300132
...

printf formater.

row << "%-#{DAT_LEN[:ABEZ]}s" % "xxx"

and ruby 1.8.7 can not handle umlaut, expectedly.

[1] 1.8.7-p358(#<Oddb2xml::Builder>)> row
"1111081911LYSTHENON 2% Inj L\303\266s 100 mg/5ml 5 Amp 5 ml       "
[2] 1.8.7-p358(main)> "Lös"[0, 3]
"L\303\266"
[3] 1.8.7-p358(#<Oddb2xml::Builder>)> "Lös".length
4

Updae to use String#scan.

[9] 1.8.7-p358(main)> "èÄ".scan(/./mu).to_a
[
    [0] "\303\250",
    [1] "\303\204"
]
[10] 1.8.7-p358(main)> "èÄ".scan(/./mu).to_a[0,1]
[
    [0] "\303\250"
]
commit

Ref.

view · edit · sidebar · attach · print · history
Page last modified on February 18, 2013, at 09:21 AM