Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

icu.InvalidArgsError

📅 2015-Nov-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

I tried running gcalcli and got this error:

$ gcalcli
Traceback (most recent call last):
  File "/usr/bin/gcalcli", line 392, in <module>
    class gcalcli:
  File "/usr/bin/gcalcli", line 410, in gcalcli
    dateParser    = DateTimeParser()
  File "/usr/bin/gcalcli", line 335, in __init__
    self.pdtCalendar = parsedatetime.Calendar();
  File "/usr/lib/python2.7/dist-packages/parsedatetime/__init__.py", line 216, in __init__
    self.ptc = Constants()
  File "/usr/lib/python2.7/dist-packages/parsedatetime/__init__.py", line 1733, in __init__
    self.locale = pdtLocales['icu'](self.localeID)
  File "/usr/lib/python2.7/dist-packages/parsedatetime/pdt_locales.py", line 151, in __init__
    self.icu = pyicu.Locale(localeID)
icu.InvalidArgsError: (<type 'icu.Locale'>, '__init__', (None,))

Solution

This is a well known bug in the parsedatetime package as described here.

The solution is to remove the package installed from Ubuntu archives and install a recent version of it from the Python Package Index:

$ sudo apt-get remove python-parsedatetime

$ sudo pip install --upgrade parsedatetime

Tried with: Ubuntu 14.04