/usr/lib/python3/dist-packages/Pyro4/__init__.py is in python3-pyro4 4.23-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | """
Pyro package. Some generic init stuff to set up logging etc.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
import sys
if sys.version_info < (2, 6):
import warnings
warnings.warn("This Pyro version is unsupported on Python versions older than 2.6", ImportWarning)
def _configLogging():
"""Do some basic config of the logging module at package import time.
The configuring is done only if the PYRO_LOGLEVEL env var is set.
If you want to use your own logging config, make sure you do
that before any Pyro imports. Then Pyro will skip the autoconfig.
Set the env var PYRO_LOGFILE to change the name of the autoconfigured
log file (default is pyro.log in the current dir). Use '{stderr}' to
make the log go to the standard error output."""
import os, logging
level = os.environ.get("PYRO_LOGLEVEL")
logfilename = os.environ.get("PYRO_LOGFILE", "pyro.log")
if logfilename == "{stderr}":
logfilename = None
if level is not None:
levelvalue = getattr(logging, level)
if len(logging.root.handlers) == 0:
# configure the logging with some sensible defaults.
try:
import tempfile
tempfile = tempfile.TemporaryFile(dir=".")
tempfile.close()
except OSError:
# cannot write in current directory, use the default console logger
logging.basicConfig(level=levelvalue)
else:
# set up a basic logfile in current directory
logging.basicConfig(
level=levelvalue,
filename=logfilename,
datefmt="%Y-%m-%d %H:%M:%S",
format="[%(asctime)s.%(msecs)03d,%(name)s,%(levelname)s] %(message)s"
)
log = logging.getLogger("Pyro4")
log.info("Pyro log configured using built-in defaults, level=%s", level)
else:
# PYRO_LOGLEVEL is not set, disable Pyro logging. No message is printed about this fact.
log = logging.getLogger("Pyro4")
log.setLevel(9999)
_configLogging()
del _configLogging
# initialize Pyro's configuration
from Pyro4.configuration import Configuration
config=Configuration()
del Configuration
# import the required Pyro symbols into this package
from Pyro4.core import URI, Proxy, Daemon, callback, batch, async
from Pyro4.naming import locateNS, resolve
from Pyro4.futures import Future
from Pyro4.constants import VERSION as __version__
|