Subject: [xml2rfc] #382 (Version_3_cli_txt): AttributeError: 'ExistingCountries' object has no attribute 'lookup'

From: "xml2rfc issue tracker" <[email-masked]>
Date: Sat, 24 Nov 2018 08:14:51 -0000

#382: AttributeError: 'ExistingCountries' object has no attribute 'lookup'

 xml2rfc version 2.14.1

 This may or may not be related to google address stuff: that version is:
 2.3.2-1
 Source markdown:
 https://raw.githubusercontent.com/mmarkdown/mmark/master/rfc/7511.md
 Generated XML:
 https://gist.githubusercontent.com/miekg/73986197ae5ac7b3f67e08460238f2f5/raw/a54341cfc7cbc41036d4baa9b7728e73177128cf/7511.xml

 This crashes with
 {{{
 7511.xml(3): Warning: Expected a <link> with rel='prev' providing the
 datatracker url for the origin draft.
 Traceback (most recent call last):
   File "/usr/bin/xml2rfc", line 11, in <module>
     load_entry_point('xml2rfc==2.14.1', 'console_scripts', 'xml2rfc')()
   File "/usr/lib/python2.7/dist-packages/xml2rfc/run.py", line 425, in
 main
     writer.write(filename)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 117, in write
     text = self.render(self.root, width=72, joiners=joiners)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 2491, in render_rfc
     ctext = self.render(c, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 688, in render_back
     text = self.join(text, c, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 166, in join
     etext = self.render(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 2764, in render_section
     text = self.join(text, c, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 166, in join
     etext = self.render(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 594, in render_author
     text = self.join(text, c, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 166, in join
     etext = self.render(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 313, in render_address
     text = self.join(text, c, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 166, in join
     etext = self.render(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 147, in render
     res = func(e, width, **kwargs)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/writers/text.py", line
 2018, in render_postal
     adr = get_normalized_address_info(self, e, latin=latin)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/util/postal.py", line 83,
 in get_normalized_address_info
     country_info = get_iso_country_info(country_element)
   File "/usr/lib/python2.7/dist-packages/xml2rfc/util/postal.py", line 69,
 in get_iso_country_info
     country_info = pycountry.countries.lookup(name)
 AttributeError: 'ExistingCountries' object has no attribute 'lookup'
 }}}

-- 
-------------------------------+--------------------
 Reporter:  [email-masked]       |      Owner:
     Type:  defect             |     Status:  new
 Priority:  medium             |  Milestone:
Component:  Version_3_cli_txt  |    Version:  2.13.x
 Keywords:                     |
-------------------------------+--------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/382>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Sat, 24 Nov 2018 10:50:17 -0000

Comment (by [email-masked]):

 I suspect an incompatibility between versions of pycountry.

 Which version do you have installed?

-- 
--------------------------------+--------------------
Resolution:                     |   Keywords:
--------------------------------+--------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/382#comment:1>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: Miek Gieben <[email-masked]>
Date: Sat, 24 Nov 2018 11:01:44 +0000

[ Quoting <[email-masked]> in "Re: [xml2rfc] #382 (Version_3_cli_t..." ]
> Which version do you have installed?

old one probably (because Debian Stable)

{{{
Package: python-pycountry
Source: pycountry
Version: 1.8+ds1-0.2
Installed-Size: 58
Maintainer: David Paleino <[email-masked]>
Architecture: all
Depends: python (<< 2.8), python (>= 2.7), python:any (>= 2.6.6-7~), iso-codes, python-lxml
Description-en: ISO databases accessible from Python 2
 pycountry provides ISO country, subdivision, language, currency and script
 definitions and their translations, taken from the iso-codes package.
 .
 This is the Python 2 version of the package.
Description-md5: ed3f8c63fd29bab318da137ab0211c70
Homepage: http://pypi.python.org/pypi/pycountry/
Section: python
Priority: extra
Filename: pool/main/p/pycountry/python-pycountry_1.8+ds1-0.2_all.deb
Size: 14716
MD5sum: 43a10e29b5007f6e562d1e824275f575
SHA256: 22347e241bc06e16a973e397f0a5c3c47f99d3713fefc1d67c933b72297e904e
}}}

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Sat, 24 Nov 2018 13:26:34 -0000

Changes (by [email-masked]):

 * status:  new => closed
 * resolution:   => fixed

Comment:

 Yes, pycountry==1.8 has a different API.  I've added support in [2770];
 will be available in the next release.

-- 
--------------------------------+--------------------
  Reporter:  [email-masked]       |      Owner:
      Type:  defect             |     Status:  closed
  Priority:  medium             |  Milestone:
 Component:  Version_3_cli_txt  |    Version:  2.13.x
Resolution:  fixed              |   Keywords:
--------------------------------+--------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/382#comment:2>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>