本文整理汇总了Python中workbench.log.log_error函数的典型用法代码示例。如果您正苦于以下问题:Python log_error函数的具体用法?Python log_error怎么用?Python log_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_schema_manager
def show_schema_manager(editor, selection, table_maintenance=False):
try:
editor.executeManagementQuery("select 1", 0)
except grt.DBError, e:
mforms.Utilities.show_error("Schema Inspector", "Can not launch the Schema Inspector because the server is unreacheble.", "OK", "", "")
log_error("Can not launch the Schema Inspector because the server is unreacheble.\n")
return False
示例2: get_table_columns
def get_table_columns(self, table):
cols = []
try:
rset = self.main.editor.executeManagementQuery("SHOW COLUMNS FROM `%s`.`%s`" % (table['schema'], table['table']), 1)
except grt.DBError, e:
log_error("SHOW COLUMNS FROM `%s`.`%s` : %s" % (table['schema'], table['table'], e))
rset = None
示例3: __init__
def __init__(self, editor, schema_name):
mforms.AppView.__init__(self, False, "schema_inspector", False)
self.editor = editor
self.tabview = mforms.newTabView()
self.add(self.tabview, True, True)
self.pages = []
tabs = [SchemaInfoPanel, TableManagerParent, ColumnManager, IndexManager, TriggerManager, ViewManager, ProcedureManager, FunctionManager, GrantsManager]
if self.editor.serverVersion.majorNumber > 5 or (self.editor.serverVersion.majorNumber == 5 and self.editor.serverVersion.minorNumber >= 1):
tabs.append(EventManager)
# tabs.append(AccessManager)
for Tab in tabs:
try:
if Tab is IndexManager:
tab = Tab(editor, schema_name, self)
else:
tab = Tab(editor, schema_name)
setattr(self, "tab_"+tab.node_name, tab)
self.pages.append(tab)
self.tabview.add_page(tab, tab.caption)
except Exception:
import traceback
log_error("Error initializing tab %s: %s\n" % (tab.node_name, traceback.format_exc()))
self.refresh()
示例4: get_info
def get_info(self):
cmd = "%s -al -so %s" % (get_exe_path("ogrinfo"), self.get_path())
p1 = cmd_executor(cmd)
sout, serr = p1.communicate(input)
if serr:
log_error("There was an error getting file information: %s" % serr)
import re
p = re.compile("^(\w+):\s(\w+)\s\(([0-9\.]+)\)", re.IGNORECASE)
for line in sout.splitlines():
if line.startswith("Layer name: "):
self.layer_name_lbl.set_text(line.split(':')[1].strip())
self.layer_name = line.split(':')[1].strip()
self.table_name.set_value(line.split(':')[1].strip())
else:
m = p.match(line)
if m is not None:
row = self.column_list.add_node()
row.set_bool(0, True)
row.set_string(1, m.group(1))
from grt.modules import Utilities
res = Utilities.fetchAuthorityCodeFromFile("%s.prj" % os.path.splitext(self.get_path())[0])
if res:
self.epsg_lbl.set_text(res)
else:
self.epsg_lbl.set_text(0)
log_info("Can't find EPSG fallback to 0")
示例5: prepare_import
def prepare_import(self):
if self.importer and self.importer.is_running:
mforms.Utilities.show_message("Importing...", "Import thread is already running.", "Ok", "", "")
raise RuntimeError("Import is already running")
self.importer = SpatialImporter()
self.importer.filepath = self.get_path()
if self.importer.filepath == None or not os.path.isfile(self.importer.filepath):
raise RuntimeError("Unable to open specified file: %s" % self.importer.filepath)
self.importer.my_pwd = self.get_mysql_password(self.main.editor.connection)
if self.importer.my_pwd == None:
log_error("Cancelled MySQL password input\n")
raise RuntimeError("Cancelled MySQL password input")
self.importer.my_host = self.main.editor.connection.parameterValues.hostName
self.importer.my_port = self.main.editor.connection.parameterValues.port
self.importer.my_user = self.main.editor.connection.parameterValues.userName
self.importer.my_schema = self.main.selected_schema
self.importer.skipfailures = self.main.content_preview_page.skipfailures_chb.get_active()
self.importer.import_overwrite = self.main.content_preview_page.skipfailures_chb.get_active()
self.importer.import_append = self.main.content_preview_page.append_chb.get_active()
if self.main.content_preview_page.table_name.get_string_value() != "":
self.importer.import_table = self.main.content_preview_page.table_name.get_string_value()
self.importer.selected_fields = ",".join(self.main.content_preview_page.get_fields())
return True
示例6: enable_mdl_instrumentation
def enable_mdl_instrumentation(self):
try:
self.ctrl_be.exec_sql("UPDATE performance_schema.setup_instruments SET enabled='YES' WHERE name = 'wait/lock/metadata/sql/mdl'")
except Exception, e:
log_error("Error enabling MDL instrumentation: %s\n" % e)
mforms.Utilities.show_error("Enable MDL Instrumentation", "Error enabling performance_schema MDL instrumentation.\n%s" % e, "OK", "", "")
return
示例7: shutdown
def shutdown(self):
log_error("shutting down admn\n")
dprint_ex(2, " closing")
self.closing = True
for tab in self.tabs:
if hasattr(tab, "shutdown"):
res = tab.shutdown()
if res is False: # It has to explicitely return False to cancel shutdown
self.closing = False
示例8: cmd_executor
def cmd_executor(cmd):
p1 = None
if platform.system() != "Windows":
try:
p1 = subprocess.Popen("exec " + cmd, stdout = subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
except OSError, exc:
log_error("Error executing command %s\n%s\n" % (cmd, exc));
import traceback
traceback.print_ext()
示例9: generateCertificates
def generateCertificates(parent, conn, conn_id):
try:
log_info("Running SSL Wizard\nParent: %s\nUser Folder: %s\nConn Parameters: %s\nConn ID: %s\n" % (str(parent), mforms.App.get().get_user_data_folder(), str(conn.parameterValues), conn_id))
p = mforms.fromgrt(parent)
log_info("Running SSL Wizard\n%s\n" % str(p))
r = SSLWizard(p, conn, conn_id)
r.run(True)
except Exception, e:
log_error("There was an exception running SSL Wizard.\n%s\n\n%s" % (str(e), traceback.format_exc()))
示例10: clear_button_clicked
def clear_button_clicked(self):
for filename in os.listdir(self.main.results_path):
filepath = os.path.join(self.main.results_path, filename)
try:
if os.path.isfile(filepath):
os.unlink(filepath)
except Exception, e:
log_error("SSL Wizard: Unable to remove file %s\n%s" % (filepath, str(e)))
return
示例11: get_message
def get_message(self, port):
if port not in self.tunnel_by_port:
log_error("Looking up invalid port %s\n" % port)
return None
tunnel = self.tunnel_by_port[port]
try:
return tunnel.q.get_nowait()
except Queue.Empty:
return None
示例12: repaint
def repaint(self, cr, x, y, w, h):
xoffs, yoffs = self.parent.relayout()
self.offset = xoffs, yoffs
c = Context(cr)
try:
self.canvas.repaint(c, xoffs, yoffs, w, h)
except Exception:
import traceback
log_error("Exception rendering dashboard: %s\n" % traceback.format_exc())
示例13: do_delete_account
def do_delete_account(self, username, host):
query = REMOVE_USER % {"user":escape_sql_string(username), "host":escape_sql_string(host)}
try:
self.ctrl_be.exec_sql("use mysql")
self.ctrl_be.exec_sql(query)
except QueryError, e:
log_error('Error removing account %[email protected]%s:\n%s' % (username, host, str(e)))
if e.error == 1227: # MySQL error code 1227 (ER_SPECIFIC_ACCESS_DENIED_ERROR)
raise Exception('Error removing the account %[email protected]%s:' % (username, host),
'You must have the global CREATE USER privilege or the DELETE privilege for the mysql '
'database')
raise e
示例14: tab_changed
def tab_changed(self):
if self.old_active_tab and hasattr(self.old_active_tab, "page_deactivated"):
self.old_active_tab.page_deactivated()
i = self.tabview.get_active_tab()
panel = self.tabs[i]
if panel is not None and hasattr(panel, "page_activated"):
try:
panel.page_activated()
except Exception, e:
import traceback
log_error("Unhandled exception in Admin for %s: %s\n" % (panel, traceback.format_exc()))
mforms.Utilities.show_error("Error", "An unhandled exception occurred (%s). Please refer to the log files for details." % e, "OK", "", "")
示例15: set_keepalive
def set_keepalive(self, port, keepalive):
if keepalive == 0:
log_info("SSH KeepAlive setting skipped.\n")
return
tunnel = self.tunnel_by_port.get(port)
if not tunnel:
log_error("Looking up invalid port %s\n" % port)
return
transport = tunnel._client.get_transport()
if transport is None:
log_error("SSHTransport not ready yet %d\n" % port)
return
transport.set_keepalive(keepalive)