Using the dynamic-dynamodb library, I get & ldquo; TypeError: The 'module' object is not callable & rdquo;


After I pulled dynamic-dynamodb via git and made my changes to example-dynamic-dynamodb.conf and install the requirements.txt, I am trying to run/start dynamic-dynamodb

I am running on AWS EC2

  • OS: ubuntu 14.04
  • python --version Python 2.6.9
  • pip --version pip 7.1.2 from /usr/local/lib/python2.6/site-packages (python 2.6)

$>cd dynamic-dynamodb

    build  cloudformation-templates  dist  docs  dynamic_dynamodb  dynamic-dynamodb  dynamic_dynamodb.egg-info  example-dynamic-dynamodb.conf  LICENSE  Makefile  MANIFEST  README  requirements.txt

    $>./dynamic-dynamodb start

Traceback (most recent call last):
   File "./dynamic-dynamodb", line 22, in <module>
    import dynamic_dynamodb
  File "/root/dynamic-dynamodb/dynamic_dynamodb/", line 29, in <module>
    from import dynamodb
  File "/root/dynamic-dynamodb/dynamic_dynamodb/aws/", line 12, in <module>
    from dynamic_dynamodb.log_handler import LOGGER as logger
  File "/root/dynamic-dynamodb/dynamic_dynamodb/", line 26, in <module>
    import config_handler
  File "/root/dynamic-dynamodb/dynamic_dynamodb/", line 5, in <module>
    CONFIGURATION = config.get_configuration()
  File "/root/dynamic-dynamodb/dynamic_dynamodb/config/", line 155, in get_configuration
    'tables': ordereddict()
TypeError: 'module' object is not callable

Is this the right way to start dynamic-dynamodb service? Dose any one have an advice?

This looks like a bug in dynamic-dynamodb.

In dynamic_dynamodb/config/ and dynamic_dynamodb/config/, there is code like:

    from collections import OrderedDict as ordereddict
except ImportError:
    import ordereddict

ImportError is caught when you're using a version lower than 2.7, and collections.OrderedDict doesn't exist. But doing just import ordereddict seems like a logical error; you want ordereddict to point to the OrderedDict class, not the module that contains the OrderedDict class.

First, I suggest upgrading to 2.7 or higher, where this is no longer a problem.

Second, If you can't do that, I suggest changing the lines in both of those files to

    from collections import OrderedDict as ordereddict
except ImportError:
    from ordereddict import OrderedDict as ordereddict

Third, if that doesn't work, I suggest filing a bug on the github page, and hopefully the author will issue a fix. (actually, you should probably do this regardless of whether the previous two approaches succeed)