]> git.phdru.name Git - bookmarks_db.git/blobdiff - robots.py
Fix(Py3): `exec` in a local namespce
[bookmarks_db.git] / robots.py
index 84a3a2bcac5069158e5acd243629d5305c145b9b..8fac908dd92bec6117d8a59a36eab17bd73b41e4 100644 (file)
--- a/robots.py
+++ b/robots.py
@@ -18,9 +18,10 @@ robot_name, robot_params = parse_params(environ.get("BKMK_ROBOT", "forking"))
 
 
 def import_robot(robot_name):
-    exec("from Robots import bkmk_r%s" % robot_name)
-    exec("robot = bkmk_r%s.robot_%s" % (robot_name, robot_name))
-    return robot
+    ns = locals()
+    exec("from Robots import bkmk_r%s" % robot_name, globals(), ns)
+    exec("robot = bkmk_r%s.robot_%s" % (robot_name, robot_name), globals(), ns)
+    return ns['robot']
 
 
 robot = import_robot(robot_name)