Beispiel #1
0
def run_main():
    """
        Parsers command line arguments and launches PyXRD accordingly.
    """

    # Make sure the current path is used for loading PyXRD modules:
    mod = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    if not mod in sys.path:
        sys.path.insert(1, mod)

    # Init settings, first import will trigger initialization
    from pyxrd.data import settings
    settings.initialize()

    # Setup basic logging
    from pyxrd.logs import setup_logging
    setup_logging(basic=True)

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace.html",
            interval=5, auto=True) # Set auto flag to always update file!

    try:
        if settings.ARGS.script:
            # Run the specified user script:
            _run_user_script()
        else:
            # Run the GUI:
            _run_gui()
    except:
        raise # re-raise the error
    finally:
        for finalizer in settings.FINALIZERS:
            finalizer()
        if settings.DEBUG: stacktracer.trace_stop()
Beispiel #2
0
def run_main():
    """
        Parsers command line arguments and launches PyXRD accordingly.
    """

    # Make sure the current path is used for loading PyXRD modules:
    mod = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    if not mod in sys.path:
        sys.path.insert(1, mod)

    # Init settings, first import will trigger initialization
    from pyxrd.data import settings
    settings.initialize()

    # Setup basic logging
    from pyxrd.logs import setup_logging
    setup_logging(basic=True)

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace.html", interval=5,
            auto=True)  # Set auto flag to always update file!

    try:
        if settings.ARGS.script:
            # Run the specified user script:
            _run_user_script()
        else:
            # Run the GUI:
            _run_gui()
    except:
        raise  # re-raise the error
    finally:
        for finalizer in settings.FINALIZERS:
            finalizer()
        if settings.DEBUG: stacktracer.trace_stop()
Beispiel #3
0
# Complete license can be found in the LICENSE file.

if __name__ == "__main__":
    import logging
    logger = logging.getLogger(__name__)
    
    import os, sys
    sys.path.insert(1, os.path.join(sys.path[0], '../..'))

    from pyxrd.data.appdirs import user_log_dir

    from pyxrd.server import settings
    from pyxrd.server.pyxrd_server import PyXRDServer
    from pyxrd.server.utils import start_script
    from pyxrd.logs import setup_logging
    setup_logging(basic=True, prefix="PYRO SERVER:")

    import Pyro4
    try:
        from Pyro4.naming import NamingError
    except (AttributeError, ImportError):
        from Pyro4.errors import NamingError


    server = PyXRDServer()

    daemon = Pyro4.Daemon()

    try:
        ns = Pyro4.locateNS()
    except NamingError:
Beispiel #4
0
import os

import Pyro4

from pyxrd.data.appdirs import user_log_dir

from .pyxrd_server import PyXRDServer
from .utils import start_script

from . import settings

if __name__ == "__main__":

    from pyxrd.logs import setup_logging
    setup_logging(basic=True, prefix="PYRO SERVER:")
    
    import logging
    logger = logging.getLogger(__name__)

    server = PyXRDServer()

    daemon = Pyro4.Daemon()

    try:
        ns = Pyro4.locateNS()
    except Pyro4.naming.NamingError:
        logger.info("NamingError encountered when trying to locate the nameserver")
        log_file = os.path.join(user_log_dir('PyXRD'), 'nameserver.log')
        start_script("start_nameserver.py", auto_kill=not settings.KEEP_SERVER_ALIVE, log_file=log_file)
        ns = Pyro4.locateNS()
Beispiel #5
0
#!/usr/bin/python

# coding=UTF-8
# ex:ts=4:sw=4:et=on

# Copyright (c) 2013, Mathijs Dumon
# All rights reserved.
# Complete license can be found in the LICENSE file.

if __name__ == "__main__":

    # Init settings, first import will trigger initialization
    from pyxrd.data import settings

    # Setup basic logging
    from pyxrd.logs import setup_logging
    setup_logging(basic=True)

    # This will generate a very slim pool of worker processes, with as little
    # as possible shared state
    from pyxrd.generic.pool import get_pool
    get_pool()

    # Setup & run PyXRD
    from pyxrd.core import run_main
    run_main()