Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(86) | Call(78) | Derive(0) | Import(8)
def stderr(string): """Print the given ``string`` to stderr. This is equivalent to ``print >> sys.stderr, string`` """ print(string, file=sys.stderr)
import willie.irc as irc from willie.db import WillieDB from willie.tools import (stderr, Nick, PriorityQueue, released, get_command_regexp, iteritems, itervalues) import willie.module as module
def setup(self): stderr("\nWelcome to Willie. Loading modules...\n\n") self.callables = set() self.shutdown_methods = set()
rel_path = os.path.relpath(filename, os.path.dirname(__file__)) raising_stmt = "%s:%d" % (rel_path, lineno) stderr("Error loading %s: %s (%s)" % (name, e, raising_stmt)) else: try:
) raising_stmt = "%s:%d" % (rel_path, lineno) stderr("Error in %s setup procedure: %s (%s)" % (name, e, raising_stmt)) if modules: stderr('\n\nRegistered %d modules,' % (len(modules) - 1))
src/w/i/willie-4.3.0/willie/bot.py willie(Download)
import willie.irc as irc from willie.db import WillieDB from willie.tools import (stderr, Nick, PriorityQueue, released, get_command_regexp, iteritems, itervalues) import willie.module as module
def setup(self): stderr("\nWelcome to Willie. Loading modules...\n\n") self.callables = set() self.shutdown_methods = set()
rel_path = os.path.relpath(filename, os.path.dirname(__file__)) raising_stmt = "%s:%d" % (rel_path, lineno) stderr("Error loading %s: %s (%s)" % (name, e, raising_stmt)) else: try:
) raising_stmt = "%s:%d" % (rel_path, lineno) stderr("Error in %s setup procedure: %s (%s)" % (name, e, raising_stmt)) if modules: stderr('\n\nRegistered %d modules,' % (len(modules) - 1))
src/w/i/willie-4.3.0/willie.py willie(Download)
import sys from willie.tools import stderr if sys.version_info < (2, 7): stderr('Error: Requires Python 2.7 or later. Try python2.7 willie') sys.exit(1) if sys.version_info.major == 3 and sys.version_info.minor < 3: stderr('Error: When running on Python 3, Python 3.3 is required.')
try: if os.getuid() == 0 or os.geteuid() == 0: stderr('Error: Do not run Willie with root privileges.') sys.exit(1) except AttributeError:
config_module = Config(configpath) except ConfigurationError as e: stderr(e) sys.exit(2)
src/w/i/willie-HEAD/willie.py willie(Download)
import sys from willie.tools import stderr if sys.version_info < (2, 7): stderr('Error: Requires Python 2.7 or later. Try python2.7 willie') sys.exit(1) if sys.version_info.major == 3 and sys.version_info.minor < 3: stderr('Error: When running on Python 3, Python 3.3 is required.')
try: if os.getuid() == 0 or os.geteuid() == 0: stderr('Error: Do not run Willie with root privileges.') sys.exit(1) except AttributeError:
config_module = Config(configpath) except ConfigurationError as e: stderr(e) sys.exit(2)
src/w/i/willie-HEAD/willie/irc.py willie(Download)
import codecs import traceback from willie.tools import stderr, Nick try: import select
ca_certs = '/etc/ssl/certs/ca-certificates.crt' if not os.path.isfile(ca_certs): stderr('Could not open CA certificates file. SSL will not ' 'work properly.')
os.mkdir(self.config.core.logdir) except Exception as e: stderr('There was a problem creating the logs directory.') stderr('%s %s' % (str(e.__class__), str(e))) stderr('Please fix this and then run Willie again.')
src/w/i/willie-4.3.0/willie/irc.py willie(Download)
import codecs import traceback from willie.tools import stderr, Nick try: import select
os.mkdir(self.config.core.logdir) except Exception as e: stderr('There was a problem creating the logs directory.') stderr('%s %s' % (str(e.__class__), str(e))) stderr('Please fix this and then run Willie again.')
def run(self, host, port=6667): try: self.initiate_connect(host, port) except socket.error as e: stderr('Connection error: %s' % e.strerror)
src/w/i/willie-HEAD/willie/__init__.py willie(Download)
def run(config): import willie.bot as bot import willie.web as web from willie.tools import stderr if config.core.delay is not None:
web.ca_certs = '/etc/ssl/certs/ca-certificates.crt' if not os.path.isfile(web.ca_certs): stderr('Could not open CA certificates file. SSL will not ' 'work properly.') def signal_handler(sig, frame): if sig == signal.SIGUSR1 or sig == signal.SIGTERM: stderr('Got quit signal, shutting down.')
trace = traceback.format_exc() try: stderr(trace) except: pass
if p.hasquit or config.exit_on_error: break stderr('Warning: Disconnected. Reconnecting in %s seconds...' % delay) time.sleep(delay) os.unlink(config.pid_file_path)
src/w/i/willie-4.3.0/willie/__init__.py willie(Download)
import signal import willie.web as web from willie.tools import stderr __version__ = '4.3.0'
def signal_handler(sig, frame): if sig == signal.SIGUSR1 or sig == signal.SIGTERM: stderr('Got quit signal, shutting down.') p.quit('Closing') while True:
trace = traceback.format_exc() try: stderr(trace) except: pass
if p.hasquit or config.exit_on_error: break stderr('Warning: Disconnected. Reconnecting in %s seconds...' % delay) time.sleep(delay) os.unlink(config.pid_file_path)