Spaces:
Sleeping
Sleeping
UPDATE: exportToDashboard
Browse files
analyticsHub/components/__init__.py
CHANGED
|
@@ -6,10 +6,12 @@ class REPLManager:
|
|
| 6 |
def __init__(self):
|
| 7 |
self.__stdout = io.StringIO()
|
| 8 |
self.__stderr = io.StringIO()
|
|
|
|
|
|
|
| 9 |
def run(self, codeString):
|
| 10 |
with contextlib.redirect_stdout(self.__stdout), contextlib.redirect_stderr(self.__stderr):
|
| 11 |
try:
|
| 12 |
-
exec(codeString,
|
| 13 |
except Exception:
|
| 14 |
traceback.print_exc(file=self.__stderr)
|
| 15 |
output, error = self.__stdout.getvalue(), self.__stderr.getvalue()
|
|
|
|
| 6 |
def __init__(self):
|
| 7 |
self.__stdout = io.StringIO()
|
| 8 |
self.__stderr = io.StringIO()
|
| 9 |
+
self._globals = dict()
|
| 10 |
+
|
| 11 |
def run(self, codeString):
|
| 12 |
with contextlib.redirect_stdout(self.__stdout), contextlib.redirect_stderr(self.__stderr):
|
| 13 |
try:
|
| 14 |
+
exec(codeString, self._globals)
|
| 15 |
except Exception:
|
| 16 |
traceback.print_exc(file=self.__stderr)
|
| 17 |
output, error = self.__stdout.getvalue(), self.__stderr.getvalue()
|