gets the value of a variable
| 1792 | |
| 1793 | |
| 1794 | class InternalConsoleExec(InternalThreadCommand): |
| 1795 | """gets the value of a variable""" |
| 1796 | |
| 1797 | def __init__(self, seq, thread_id, frame_id, expression): |
| 1798 | self.sequence = seq |
| 1799 | self.thread_id = thread_id |
| 1800 | self.frame_id = frame_id |
| 1801 | self.expression = expression |
| 1802 | |
| 1803 | def init_matplotlib_in_debug_console(self, py_db): |
| 1804 | # import hook and patches for matplotlib support in debug console |
| 1805 | from _pydev_bundle.pydev_import_hook import import_hook_manager |
| 1806 | |
| 1807 | if is_current_thread_main_thread(): |
| 1808 | for module in list(py_db.mpl_modules_for_patching): |
| 1809 | import_hook_manager.add_module_name(module, py_db.mpl_modules_for_patching.pop(module)) |
| 1810 | |
| 1811 | def do_it(self, py_db): |
| 1812 | if not py_db.mpl_hooks_in_debug_console and not py_db.gui_in_use: |
| 1813 | # add import hooks for matplotlib patches if only debug console was started |
| 1814 | try: |
| 1815 | self.init_matplotlib_in_debug_console(py_db) |
| 1816 | py_db.gui_in_use = True |
| 1817 | except: |
| 1818 | pydev_log.debug("Matplotlib support in debug console failed", traceback.format_exc()) |
| 1819 | py_db.mpl_hooks_in_debug_console = True |
| 1820 | |
| 1821 | try: |
| 1822 | try: |
| 1823 | # Don't trace new threads created by console command. |
| 1824 | disable_trace_thread_modules() |
| 1825 | |
| 1826 | result = pydevconsole.console_exec(self.thread_id, self.frame_id, self.expression, py_db) |
| 1827 | xml = "<xml>" |
| 1828 | xml += pydevd_xml.var_to_xml(result, "") |
| 1829 | xml += "</xml>" |
| 1830 | cmd = py_db.cmd_factory.make_evaluate_expression_message(self.sequence, xml) |
| 1831 | py_db.writer.add_command(cmd) |
| 1832 | except: |
| 1833 | exc = get_exception_traceback_str() |
| 1834 | sys.stderr.write("%s\n" % (exc,)) |
| 1835 | cmd = py_db.cmd_factory.make_error_message(self.sequence, "Error evaluating console expression " + exc) |
| 1836 | py_db.writer.add_command(cmd) |
| 1837 | finally: |
| 1838 | enable_trace_thread_modules() |
| 1839 | |
| 1840 | sys.stderr.flush() |
| 1841 | sys.stdout.flush() |
| 1842 | |
| 1843 | |
| 1844 | class InternalLoadFullValue(InternalThreadCommand): |
no outgoing calls
no test coverage detected