All Samples(408) | Call(357) | Derive(0) | Import(51)
Log a message with severity 'CRITICAL' on the root logger.
def critical(msg, *args, **kwargs):
"""
Log a message with severity 'CRITICAL' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.critical(msg, *args, **kwargs)
try:
remoteClass = importClass(rel.remoteClass, None)
except AttributeError, e:
logging.critical("RemoteClass '%s' from '%s.%s' not found",
rel.remoteClass, cls.__name__, relname)
continue
try:
rschema = lookupSchema(remoteClass, rel.remoteName)
except ZenSchemaError, e:
logging.critical("Inverse def '%s' for '%s.%s' not found on '%s'",
rel.remoteName, cls.__name__, relname,rel.remoteClass)
continue
except Exception, e:
logging.critical("RemoteClass '%s' for '%s.%s' problem.",
except Exception, e:
logging.critical("RemoteClass '%s' for '%s.%s' problem.",
rel.remoteName, cls.__name__, relname)
logging.critical(e)
continue
try:
localClass = importClass(rschema.remoteClass, None)
except AttributeError, e:
logging.critical(e)
if not issubclass(cls, localClass):
logging.critical("Inverse def '%s' from '%s.%s' wrong "
"remoteClass: '%s'", rel.remoteName, cls.__name__,
relname,rschema.remoteClass)
if rschema.remoteName != relname:
logging.critical("Inverse def '%s' from '%s.%s' wrong "
"remoteName: '%s'", rel.remoteName, cls.__name__, relname,
rschema.remoteName)
if rel.remoteType != rschema.__class__:
logging.critical("'%s.%s' inverse '%s' type %s != %s",
src/z/e/zenoss-HEAD/Products/ZenRelations/checkrel.py zenoss(Download)
try:
remoteClass = importClass(rel.remoteClass, None)
except AttributeError, e:
logging.critical("RemoteClass '%s' from '%s.%s' not found",
rel.remoteClass, cls.__name__, relname)
continue
try:
rschema = lookupSchema(remoteClass, rel.remoteName)
except ZenSchemaError, e:
logging.critical("Inverse def '%s' for '%s.%s' not found on '%s'",
rel.remoteName, cls.__name__, relname,rel.remoteClass)
continue
except Exception, e:
logging.critical("RemoteClass '%s' for '%s.%s' problem.",
except Exception, e:
logging.critical("RemoteClass '%s' for '%s.%s' problem.",
rel.remoteName, cls.__name__, relname)
logging.critical(e)
continue
try:
localClass = importClass(rschema.remoteClass, None)
except AttributeError, e:
logging.critical(e)
if not issubclass(cls, localClass):
logging.critical("Inverse def '%s' from '%s.%s' wrong "
"remoteClass: '%s'", rel.remoteName, cls.__name__,
relname,rschema.remoteClass)
if rschema.remoteName != relname:
logging.critical("Inverse def '%s' from '%s.%s' wrong "
"remoteName: '%s'", rel.remoteName, cls.__name__, relname,
rschema.remoteName)
if rel.remoteType != rschema.__class__:
logging.critical("'%s.%s' inverse '%s' type %s != %s",
src/p/y/python-application-1.2.5/application/log/__init__.py python-application(Download)
def critical(message, **context):
logging.critical(message, extra=context)
def exception(message=None, **context):
logging.error(message, exc_info=1, extra=context)
# Some aliases that are commonly used
src/g/o/google-app-engine-HEAD/google/appengine/tools/appcfg.py google-app-engine(Download)
'requested in app.yaml.')
return
if self.config.api_version not in version['api_versions']:
logging.critical('The api_version specified in app.yaml (%s) is not '
'supported by this release of the SDK. The supported '
'api_versions are %s.',
self.config.api_version, version['api_versions'])
src/g/a/gaesdk-python-HEAD/google/appengine/tools/appcfg.py gaesdk-python(Download)
'requested in app.yaml.')
return
if self.config.api_version not in version['api_versions']:
logging.critical('The api_version specified in app.yaml (%s) is not '
'supported by this release of the SDK. The supported '
'api_versions are %s.',
self.config.api_version, version['api_versions'])
src/g/o/google_appengine-HEAD/google/appengine/tools/appcfg.py google_appengine(Download)
"requested in app.yaml.")
return
if self.config.api_version not in version["api_versions"]:
logging.critical("The api_version specified in app.yaml (%s) is not "
"supported by this release of the SDK. The supported "
"api_versions are %s.",
self.config.api_version, version["api_versions"])
src/p/l/Plowman-HEAD/bookbyline.py Plowman(Download)
self.connection = sqlite3.connect(self.db_name)
except IOError:
logging.critical(
"Couldn't read from, or create a db. That's a show-stopper."
)
raise
with self.connection:
oavals = self._create_oauth()
except sqlite3.OperationalError:
logging.critical(
"Couldn't insert new row into table. Exiting")
# close the SQLite connection, and quit
raise
self.cursor.execute \
# attempt to create OAuth credentials
import getOAuth
except ImportError:
logging.critical("Couldn't import getOAuth module")
raise
try:
oav = {}
getOAuth.get_creds(oav)
except tweepy.TweepError, err:
print "Couldn't complete OAuth setup for %s. Fatal. Exiting.\n\
Error was: %s" % (self.book_digest, err)
logging.critical(
"Couldn't complete OAuth setup for %s.\nError was: %s",\
else:
print payload
except tweepy.TweepError, err:
logging.critical("Couldn't update status. Error was: %s", err)
raise
self.database.write_vals(
self.position["lastline"],
def imp_file(list_from_file):
""" Try to import a text file, strip blank lines, format as a list
"""
try:
return tuple(line for line in list_from_file if line.strip())
except IOError:
logging.critical("Couldn't read from file %s. exiting", list_from_file)
src/a/p/AppEngine-mlk-1.3.6/google/appengine/tools/appcfg.py AppEngine-mlk(Download)
'requested in app.yaml.')
return
if self.config.api_version not in version['api_versions']:
logging.critical('The api_version specified in app.yaml (%s) is not '
'supported by this release of the SDK. The supported '
'api_versions are %s.',
self.config.api_version, version['api_versions'])
src/f/i/filelocker2-HEAD/core/Filelocker.py filelocker2(Download)
else:
self.directory = Directory.directory_factory(self)
if self.localDirectory is None:
logging.critical("[system] [init] Local Directory is None!]")
if self.directory is None:
logging.critical("[system] [init] [Directory is None!]")
newFile.close()
f.close()
except IOError, ioe:
logging.critical("[%s] [createEncryptedMessageFile] [There was an IOError while checking in new file: %s]" % (message.messageOwnerId,str(ioe)))
raise FLError(False, ["There was an IO error while uploading: %s. The administrator has been notified of this error." % str(ioe)])
except Exception, e:
logging.critical("[%s] [createEncryptedMessageFile] [There was an Error while checking in new file: %s]" % (message.messageOwnerId,str(e)))
else:
flFile.filePassedAvScan = True
except OSError, oe:
logging.critical("[%s] [checkInFile] [AVSCAN execution failed: %s]", (user.userId, str(oe)))
raise FLError(False, ["System was unable to complete the virus scan on %s: %s." % (str(oe), fileName)])
else: flFile.filePassedAvScan = False
#Determine file size and check against quota
try:
flFile.fileSizeBytes = os.stat(filePath)[ST_SIZE]
if (self.db.getCurrentQuotaUsage(user.userId) + flFile.fileSizeBytes) >= (user.userQuota*1024*1024):
logging.warning("[%s] [checkInFile] [User has insufficient quota space remaining to check in file: %s]" % (user.userId, flFile.fileName))
raise FLError(False, ["You may not upload this file as doing so would exceed your quota"])
except Exception, e:
logging.critical("[%s] [checkInFile] [Unable to get file size: %s]" % (user.userId, str(e)))
self.log_action(user.userId, "File Checked In", None, "File %s (%s) checked in to Filelocker" % (flFile.fileName, flFile.fileId))
logging.info("[%s] [checkInFile] [User checked in a new file %s]" % (user.userId, flFile.fileName))
except IOError, ioe:
logging.critical("[%s] [checkInFile] [There was an IOError while checking in new file: %s]" % (user.userId,str(ioe)))
raise FLError(False, ["There was an IO error while uploading: %s. The administrator has been notified of this error." % str(ioe)])
except Exception, e:
logging.critical("[%s] [checkInFile] [There was an Error while checking in new file: %s]" % (user.userId,str(e)))
logging.error("[system] [processDeletionQueue] [File %s not deleted because it doesn't exist - dequeuing]" % (self.vault+"/"+filePath))
self.db.deQueueForDeletion(filePath)
except Exception, e:
logging.critical("[system] [processDeletionQueue] [Couldn't delete file in deletion queue: %s]" % str(e))
def get_vault_usage(self):
s = os.statvfs(self.vault)
src/c/h/chestnut-dialer-HEAD/trunk/chestnut_dialer/main.py chestnut-dialer(Download)
elif o in ("-a", "--account"):
try: account_id = int(v)
except ValueError:
logging.critical(_("account id must have an integer numeric value"))
sys.exit(chestnut_dialer.EX_USAGE)
elif o in ("-n", "--account-name"):
account_name = unicode(v, chestnut_dialer.locale_encoding)
i = token.find("=")
if i != -1:
if unset:
logging.critical(_("syntax error in account attributes"))
sys.exit(chestnut_dialer.EX_USAGE)
attr = token[0:i]
val = token[i+1:]
elif atype == 'integer':
try: value = int(val)
except ValueError:
logging.critical(_("invalid value '%s' for an integer attribute"), val)
sys.exit(chestnut_dialer.EX_ARGSERR)
elif atype == 'boolean':
if val.lower() in ("0", "no", "false", "disable", "off"): value = 0
elif val.lower() in ("1", "yes", "true", "enable", "on"): value = 1
else:
logging.critical(_("invalid value '%s' for an boolean attribute"), val)
elif atype == 'list':
value = val.split(",")
else:
logging.critical(_("invalid account attribute '%s'"), attr)
sys.exit(chestnut_dialer.EX_ARGSERR)
acc_attrs.update({attr: value})
elif token == "unset": unset = 1
elif unset == 1:
if not Account.meta.has_key(token):
logging.critical(_("invalid account attribute '%s'"), token)
unset = 0
if acc_attrs.has_key('id'):
logging.critical(_("account identifier modification is not permitted"))
sys.exit(chestnut_dialer.EX_ARGSERR)
if command == "list-ui":
ui_p.has_key("description") and ui_p["description"] or ""))
sys.exit(chestnut_dialer.EX_OK)
else:
logging.critical(_("user interface '%s' not found"), v)
sys.exit(chestnut_dialer.EX_ARGSERR)
else:
logging.critical(_("you must specify user interface with -i or --ui option"))
if ui_info == None:
if ui != None:
logging.critical(_("user interface '%s' not found"), ui)
else:
logging.critical(_("user interface for '%s' not found. You may need to pass --ui=none option"), ui_type)
sys.exit(chestnut_dialer.EX_ARGSERR)
if daemon:
p = os.fork()
if p < 0:
logging.critical(_("fork() failed"))
sys.exit(chestnut_dialer.EX_OSERR)
if p > 0: sys.exit(chestnut_dialer.EX_OK)
os.setsid()
try:
account = app.accounts.get_account(account_id)
except chestnut_dialer.account_set.NoAccountException:
logging.critical(_("account with identifier %d not exists"), account_id)
app.destroy()
sys.exit(chestnut_dialer.EX_ARGSERR)
elif account_name != None:
n = account_name.lower()
for aname, aid in app.accounts.ls_accounts():
if aname.lower().find(n) >= 0:
account = app.accounts.get_account(aid)
break
if account == None:
logging.critical(_("no account with name matching '%s' found"), account_name)
app.connect(account)
ex_status = app.run()
else:
logging.critical(_("no dial options"))
app.destroy()
sys.exit(chestnut_dialer.EX_USAGE)
elif command == "print":
if account != None:
print_account(account)
else:
logging.critical(_("you must specify account id with -a or --account option"))
app.accounts.remove_accounts([account.id])
account = None
else:
logging.critical(_("you must specify account id with -a or --account option"))
app.destroy()
sys.exit(chestnut_dialer.EX_USAGE)
elif command == "create":
if account != None:
account.update(acc_attrs)
else:
logging.critical(_("you must specify account id with -a or --account option"))
app.destroy()
sys.exit(chestnut_dialer.EX_USAGE)
elif command == "list-accounts":
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next