Skip to content

Can't use DotMap with exec? #56

@frdfsnlght

Description

@frdfsnlght

Here's some sample code:

from dotmap import DotMap

code = 'print("hello")'
g = {}
l = DotMap()
exec(code, g, l)

And it's output (using python 3.7.3 on Raspbian):

Traceback (most recent call last):
  File "dotmaptest.py", line 7, in <module>
    exec(code, g, l)
  File "<string>", line 1, in <module>
TypeError: 'DotMap' object is not callable

Any idea why I can't use a DotMap as the "locals" parameter? Using a standard dictionary works, of course. I can't seem to find any obvious answer, but maybe I'm missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions