def run(cabinmode=False, script=None, execute=None, quiet=False): using_libedit = 'libedit' in readline.__doc__ if using_libedit: print colorize('\n'.join([ 'libedit version of readline detected.', 'readline will not be well behaved, which may cause all sorts', 'of problems for the psiTurk shell. We highly recommend installing', 'the gnu version of readline by running "sudo pip install gnureadline".', 'Note: "pip install readline" will NOT work because of how the OSX', 'pythonpath is structured.' ]), 'red', False) sys.argv = [sys.argv[0]] # Drop arguments which were already processed in command_line.py #opt = docopt(__doc__, sys.argv[1:]) config = PsiturkConfig() config.load_config() server = control.ExperimentServerController(config) if cabinmode: shell = PsiturkShell(config, server) shell.check_offline_configuration() else: shell = PsiturkNetworkShell( config, server, \ config.getboolean('Shell Parameters', 'launch_in_sandbox_mode'), quiet=quiet) if script: with open(script, 'r') as temp_file: for line in temp_file: shell.onecmd_plus_hooks(line) elif execute: shell.onecmd_plus_hooks(execute) else: shell.cmdloop()
def run(cabinmode=False, script=None, execute=None, quiet=False): using_libedit = 'libedit' in readline.__doc__ if using_libedit: print colorize('\n'.join([ 'libedit version of readline detected.', 'readline will not be well behaved, which may cause all sorts', 'of problems for the psiTurk shell. We highly recommend installing', 'the gnu version of readline by running "sudo pip install gnureadline".', 'Note: "pip install readline" will NOT work because of how the OSX', 'pythonpath is structured.' ]), 'red', False) sys.argv = [sys.argv[0]] # Drop arguments which were already processed in command_line.py #opt = docopt(__doc__, sys.argv[1:]) config = PsiturkConfig() config.load_config() server = control.ExperimentServerController(config) if cabinmode: shell = PsiturkShell(config, server) shell.check_offline_configuration() else: shell = PsiturkNetworkShell( config, server, \ config.getboolean('Shell Parameters', 'launch_in_sandbox_mode'), quiet=quiet) if script: with open(script, 'r') as temp_file: for line in temp_file: shell.onecmd_plus_hooks(line) elif execute: shell.onecmd_plus_hooks(execute) else: shell.cmdloop()
def __init__(self, config=None, web_services=None, tunnel=None, sandbox=None): if not config: config = PsiturkConfig() config.load_config() self.config = config if web_services: self._cached_web_services = web_services if not tunnel: tunnel = TunnelServices(config) self.tunnel = tunnel if not sandbox: sandbox = config.getboolean('Shell Parameters', 'launch_in_sandbox_mode') self.sandbox = sandbox
def __init__(self, config=None, web_services=None, tunnel=None, sandbox=None): if not config: config = PsiturkConfig() config.load_config() self.config = config if web_services: self._cached_web_services = web_services if not tunnel: tunnel = TunnelServices(config) self.tunnel = tunnel if not sandbox: sandbox = config.getboolean('Shell Parameters', 'launch_in_sandbox_mode') self.sandbox = sandbox
from psiturk_config import PsiturkConfig config = PsiturkConfig() # Set up logging logfilepath = os.path.join(os.getcwd(), config.get("Server Parameters", "logfile")) loglevels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL] loglevel = loglevels[config.getint('Server Parameters', 'loglevel')] logging.basicConfig( filename=logfilepath, format='%(asctime)s %(message)s', level=loglevel ) # config.get( 'Mechanical Turk Info', 'aws_secret_access_key' ) # constants USING_SANDBOX = config.getboolean('HIT Configuration', 'using_sandbox') CODE_VERSION = config.get('Task Parameters', 'code_version') # Database configuration and constants TABLENAME = config.get('Database Parameters', 'table_name') SUPPORT_IE = config.getboolean('Server Parameters', 'support_IE') # Status codes ALLOCATED = 1 STARTED = 2 COMPLETED = 3 DEBRIEFED = 4 CREDITED = 5 QUITEARLY = 6 app = Flask("Experiment_Server")
logfilepath = os.path.join(os.getcwd(), config.get("Server Parameters", "logfile")) loglevels = [ logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL ] loglevel = loglevels[config.getint('Server Parameters', 'loglevel')] logging.basicConfig(filename=logfilepath, format='%(asctime)s %(message)s', level=loglevel) # config.get( 'Mechanical Turk Info', 'aws_secret_access_key' ) # constants USING_SANDBOX = config.getboolean('HIT Configuration', 'using_sandbox') CODE_VERSION = config.get('Task Parameters', 'code_version') # Database configuration and constants TABLENAME = config.get('Database Parameters', 'table_name') SUPPORT_IE = config.getboolean('Server Parameters', 'support_IE') # Status codes ALLOCATED = 1 STARTED = 2 COMPLETED = 3 DEBRIEFED = 4 CREDITED = 5 QUITEARLY = 6 app = Flask("Experiment_Server")