Пример #1
0
def get_log_path():
    """
    获取日志路径
    :return:
    """
    try:
        import configparser
        configparser = configparser.ConfigParser()
        configparser.read(config_file)

        file_handler_args = configparser.get("handler_fileHandler", "args")
        logargs = str(file_handler_args).replace("(",
                                                 "").replace(")",
                                                             "").split(",")
        logfile = os.path.join(root_path, str(logargs[0]).replace("'", ""))

        # 创建日志目录
        logdir = os.path.dirname(logfile)
        if not os.path.exists(logdir):
            os.makedirs(logdir)

        logargs.pop(0)
        logargs.insert(0, "'{0}'".format(logfile))
        logargs = "({0})".format(",".join(logargs))
        configparser.set("handler_fileHandler", "args", logargs)
    except Exception as ex:
        traceback.print_stack()
        return config_file
    else:
        return configparser
Пример #2
0
def getIniPath():
    global iniPath
    global filename
    while ~iniset:
        try:
            configparser.sections()
            configparser.read(iniPath)
            filename = configparser['LOGPATH']['filename']
            return iniPath
            break
        except:
            iniPath = input("Geben sie den INI Pfad an")
Пример #3
0
def submit_reader(projectpath, default_description=None, excludes=None, project=None, project_counter=0):
    """
    Read and yield all tasks from the project in path

    For 'submitted' projects that already have manifests and should not be altered in any way.
    """
    for root, dirs, files in os.walk(projectpath, topdown=True):
        walkdirs = list(dirs)
        for file in files:
            if file == 'ht.manifest.bz2':
                dirs[:] = []
                if root.endswith('.finished'):
                    filepath = os.path.join(root, file)
                    dirpath = root
                    runs = glob.glob(os.path.join(dirpath, "ht.run.*"))
                    runs = sorted(runs, key=lambda d: datetime.datetime.strptime(os.path.basename(d)[7:], "%Y-%m-%d_%H.%M.%S"))
                    if len(runs) >= 1:
                        rundir = runs[-1]
                        dates = [datetime.datetime.strptime(os.path.basename(run)[7:], "%Y-%m-%d_%H.%M.%S") for run in runs]
                    now = datetime.datetime.now()
                    if os.path.exists(os.path.join(dirpath, 'ht_steps')):
                        f = open(os.path.join(dirpath, 'ht_steps'))
                        ht_steps_file = f.readlines()
                        f.close()
                        # Handle runs I did before policy of code name and version in ht_steps script...
                        if ht_steps_file[2].strip() == "# PREINIT run. Runs two relaxations, without being overly concerned with":
                            code = Code('httk formation energy relaxation runs', '0.9')
                        else:
                            codename = ht_steps_file[2][1:].strip()
                            codeversion = ht_steps_file[3][1:].strip()
                            code = Code(codename, codeversion)
                    else:
                        code = Code('unknown', '0')
                    if os.path.exists(os.path.join(dirpath, 'ht.config')):
                        configparser = configparser.ConfigParser()
                        configparser.read(os.path.join(dirpath, 'ht.config'))
                        if configparser.has_option('main', 'description'):
                            description = configparser.get('main', 'description')
                        else:
                            description = default_description
                    else:
                        description = default_description
                    (manifest_hash, signatures, project_key, keys) = read_manifest(filepath, verify_signature=False)
                    relpath = os.path.relpath(root, projectpath)
                    computation = Computation.create(computation_date=dates[-1], added_date=now, description=description,
                                                     code=code, manifest_hash=manifest_hash,
                                                     signatures=signatures, keys=keys, relpath=relpath, project_counter=project_counter)
                    if project is not None:
                        computation.add_project(project)

                    yield dirpath, computation
Пример #4
0
def get_train_images():
    import configparser
    import os
    configparser = configparser.ConfigParser()
    configparser.read('config.ini')
    config = configparser['Geral']
    train_path = config['TrainPath']
    train_folder = os.fsencode(train_path)
    files = os.listdir(train_folder)
    imagens = []
    for file in files:
        filename = os.fsdecode(file)
        id = filename[:12]
        image = obtem_imagem(train_path, id)
        if (image.any()):
            imagens.append((id, image))
    return imagens
Пример #5
0
class Config(object):
    BASE_DIR = Path(__file__).parent
    ROOT_DIR = BASE_DIR.parent
    DATABASE_PATH = pjoin(ROOT_DIR, 'database.db')
    SQLALCHEMY_DATABASE_URI = 'sqlite:///{0}'.format(DATABASE_PATH)

    SQLALCHEMY_TRACK_MODIFICATIONS = False

    configparser = configparser.ConfigParser(interpolation=None)
    configparser.read(pjoin(ROOT_DIR, 'secret.ini'))
    SECRET_KEY = r'{}'.format(configparser['app']['SECRET_KEY'])
Пример #6
0
def api_call(context, result_limit=10):
    config = configparser.read('api_key.ini')
    api_key = config['api_key']
    # url is read from the application context - this represents the runtime configuration of the application
    # application context usually contains data that will be different e.g. IP addresses, names, credentials etc.
    url = context.url

    # ensure your credentials are ALWAYS passed in the header or body of the POST
    cookies = {'cookies': 'api_key={}'.format(api_key)}
    body = {'limit': result_limit}

    response = requests.get(url, cookies=cookies, data=body)

    if response.status_code != 200:
        raise Exception('API call error: {}'.format(response))
    else:
        return response.data
Пример #7
0
    def read(self, filenames):
        """Load a config file and do environment variable interpolation on the section names."""
        result = ConfigParser.read(self, filenames)
        for section in self.sections():
            original_section = section
            matches = self.r.search(section)
            while matches:
                env_key = matches.group(1)
                if env_key in os.environ:
                    section = section.replace(matches.group(0),
                                              os.environ[env_key])
                else:
                    raise ValueError(
                        'Cannot find {0} in environment for config interpolation'
                        .format(env_key))

                matches = self.r.search(section)
            if section != original_section:
                self.add_section(section)
                for (option, value) in self.items(original_section):
                    self.set(section, option, value)
                self.remove_section(original_section)
        return result
Пример #8
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# @date: 2020/6/29 17:30
# @name: sql
# @author:menghuan.wmc
import os, sys
path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(path)
from config import setting
from pymysql.err import OperationalError
import configparser as cpg
from pymysql import connect, cursors

#读取配置文件中的db信息
cpg = cpg.RawConfigParser()
t = cpg.read(setting.Test_config, encoding='utf-8')
host = cpg.get('test_mysqlconf', 'host')
port = cpg.get('test_mysqlconf', 'port')
user = cpg.get('test_mysqlconf', 'user')
pwd = cpg.get('test_mysqlconf', 'password')
db = cpg.get('test_mysqlconf', 'db_name')


class Dbconnect():
    def __init__(self):
        try:
            self.conn = connect(host=host,
                                port=int(port),
                                user=user,
                                password=pwd,
                                db=db,
Пример #9
0
import sys
import time
import smtplib
import ssl
import datetime
import logging
import configparser
import threading

vibrationSensor = DigitalInputDevice(14)
logging.basicConfig(filename="/home/pi/DryerPi/dryerPi.log",
                    level=logging.INFO)
configparser = configparser.ConfigParser()

try:
    configparser.read('/home/pi/DryerPi/config.txt')
    logging.info("Config file loaded: %s" %
                 datetime.datetime.now().strftime("%H:%M:%S- %b %d %Y"))
except Exception as e:
    logging.error("Unable to load configuration file: %s :%s" %
                  (e, datetime.datetime.now().strftime("%H:%M:%S- %b %d %Y")))

credentials = 'Credentials'
config = 'Configuration'


def vibration(x):
    global isVibrating
    global vibrationStartTime
    global vibrationEndTime
    vibrationEndTime = time.time()
Пример #10
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 30 22:13:55 2021

@author: qiwang
"""

import os
import configparser as cp

os.listdir(os.getcwd())

cp = cp.ConfigParser()
cp.read('UP_2D_FA7.ini')
sections = cp.sections()
# laod database to dict
parser_dict = {s: dict(cp.items(s)) for s in cp.sections()}
Пример #11
0
import configparser
import numpy as np
import pydicom
import datetime
import sys
import cv2
import imutils
from matplotlib import pyplot as plt
from skimage.color import label2rgb
from skimage.filters import threshold_multiotsu

# inicializacao
configparser = configparser.ConfigParser()
configparser.read('config.ini')
try:
    config = configparser['Geral']
except KeyError:
    now = datetime.datetime.now()
    msg = "Problema ao obter configuração, verifique se você está rodando o programa no diretório principal do projeto."
    print("[ERROR] {} : {}".format(now.strftime("%Y-%m-%d %H:%M:%S.%f"), msg),
          flush=True)
    sys.exit()

# CONSTANTES

DEFAULT_SIZE = 512

HEMORRAGE_MIN = 48  #65
HEMORRAGE_MAX = 95

VENTRICULO_MIN = 0
Пример #12
0
    content += 'Today\'s report: \n\n'
    content += 'DONE: \n'
    for index, log in enumerate(logs):
        content += str(index + 1) + '. ' + log + '.\n'
    content += '\n'
    content += 'TODO: \n\n'
    content += 'Thanks, \n'
    content += 'Flyn \n'
    return content


date = time.strftime('%Y%m%d', time.localtime(time.time()))
title = 'Daily_Report_Flyn_%s' % date

configparser = configparser.ConfigParser()
configparser.read(os.path.dirname(os.path.realpath(__file__)) + '\\config.txt')

mail_sender = MailSender()

mail_sender.to_address = configparser.get("Info", "to_address")
mail_sender.from_address = configparser.get("Info", "from_address")
mail_sender.my_name = configparser.get("Info", "my_name")
mail_sender.password = configparser.get("Info", "password")
mail_sender.smtp_server = configparser.get("Info", "smtp_server")
mail_sender.smtp_server_port = configparser.get("Info", "smtp_server_port")

paths = configparser.get("Info", "path")  # type:str
path_list = paths.split(",")
git_logs = git.get_commit_logs(path_list, 'flyn.yu')
content = get_mail_content(git_logs)
Пример #13
0
# Simple script to demo how to read a config file in Python 3

import configparser


configparser = configparser.RawConfigParser()   
configparser.read("options.cfg")


username = configparser.get('settings', 'username')
camera = configparser.get('settings', 'camera')


print ("Hello ",username)

if camera == "yes":
	print ("Camera is installed")
else:
	print ("No camera installed")


print ("End of script")

Пример #14
0
    return g.db


def close_db(e=None):
    db = g.pop('db', None)

    if db is not None:
        db.close()


# --------- Global Configs ---------
configparser = configparser.ConfigParser()

if (os.getenv('APP_ENV') == 'production'):
    configparser.read('/app/config.ini')  # Docker
else:
    configparser.read('config.ini')  # Local

host = configparser['Server']['host']
port = configparser['Server']['port']
database = configparser['Server']['database']
api_endpoint = configparser['Api']['endpoint']

# --------- App Configs ---------
app = Flask(__name__, instance_relative_config=False)

if (os.getenv('APP_ENV') == 'production'):
    app.config.from_pyfile('/app/config.py')
else:
    app.config.from_pyfile('config.py')
Пример #15
0
            stringToClean = stringToClean.replace(elem, replacementChar)
    return stringToClean


# Check if the config file exists (If not, exit script)
if not os.path.isfile(sys.argv[1]):
    print("Please provide a valid file for the config.\nYour provided: " +
          str(sys.argv[1]))
    raise SystemExit(0)
else:
    print("Config file found.")
    configFilePath = sys.argv[1]

# Pull in variables from config file
configparser = configparser.RawConfigParser()
configparser.read(configFilePath)
# General group
outputPath = configparser.get('General', 'outputPath')
subfolderToggle = configparser.get('General', 'subfolderToggle')
getComments = configparser.get('General', 'getComments')
getImage = configparser.get('General', 'getImage')
imageNameType = configparser.get('General', 'imageNameType')
runHeadless = configparser.get('General', 'runHeadless')
buildHTML = configparser.get('General', 'buildHTML')
# Comic group
comicName = configparser.get('Comic', 'comicName')
comicStartPage = configparser.get('Comic', 'comicStartPage')
commentPath = configparser.get('Comic', 'commentPath')
imageTitlePath = configparser.get('Comic', 'imageTitlePath')
nextButtonPath = configparser.get('Comic', 'nextButtonPath')
nextButtonType = configparser.get('Comic', 'nextButtonType')
Пример #16
0
def reader(projectpath, inpath, excludes=None, default_description=None, project_counter=0, force_remake_manifests=False):
    """
    Read and yield all tasks from the project in path
    """

    keydir = os.path.join(projectpath, 'ht.project', 'keys')
    pk = None
    sk = None

    for root, dirs, files in os.walk(inpath, topdown=True):
        walkdirs = list(dirs)
        for dir in walkdirs:
            if dir.startswith('ht.task.'):
                dirs.remove(dir)
                if dir.endswith('.finished'):
                    dirpath = os.path.join(root, dir)
                    filepath = os.path.join(dirpath, 'ht.manifest.bz2')
                    runs = glob.glob(os.path.join(dirpath, "ht.run.*"))
                    runs = sorted(runs, key=lambda d: datetime.datetime.strptime(os.path.basename(d)[7:], "%Y-%m-%d_%H.%M.%S"))
                    if len(runs) < 1:
                        continue
                    rundir = runs[-1]
                    dates = [datetime.datetime.strptime(os.path.basename(run)[7:], "%Y-%m-%d_%H.%M.%S") for run in runs]
                    now = datetime.datetime.now()
                    if os.path.exists(os.path.join(dirpath, 'ht_steps')):
                        f = open(os.path.join(dirpath, 'ht_steps'))
                        ht_steps_file = f.readlines()
                        f.close()
                        # Handle runs I did before policy of code name and version in ht_steps script...
                        codename = ht_steps_file[2][1:].strip()
                        codeversion = ht_steps_file[3][1:].strip()
                        code = Code(codename, codeversion)
                    else:
                        code = Code('unknown', '0')
                    if os.path.exists(os.path.join(dirpath, 'ht.config')):
                        configparser = configparser.ConfigParser()
                        configparser.read(os.path.join(dirpath, 'ht.config'))
                        if configparser.has_option('main', 'description'):
                            description = configparser.get('main', 'description')
                        else:
                            description = default_description
                    else:
                        description = default_description
                    if not os.path.exists(os.path.join(dirpath, 'ht.manifest.bz2')) or force_remake_manifests:
                        if pk is None:
                            sk, pk = read_keys(keydir)
                        sys.stderr.write("Warning: generating manifest for "+str(dirpath)+", this takes some time.\n")
                        manifestfile = bz2.BZ2File(os.path.join(dirpath, 'ht.tmp.manifest.bz2'), 'w')
                        manifest_dir(dirpath, manifestfile, os.path.join(dirpath, 'ht.config'), keydir, sk, pk, force=force_remake_manifests)
                        manifestfile.close()
                        os.rename(os.path.join(dirpath, 'ht.tmp.manifest.bz2'), os.path.join(dirpath, 'ht.manifest.bz2'))

                    (manifest_hash, signatures, project_key, keys) = read_manifest(os.path.join(dirpath, 'ht.manifest.bz2'), verify_signature=False)

                    #(input_manifest, input_hexhash) = check_or_generate_manifest_for_dir(code.name,code.version, path, excluderuns, None, False)
                    # Relpath is this tasks path relative to the *project* path.
                    relpath = os.path.relpath(root, projectpath)
                    computation = Computation.create(computation_date=dates[-1], added_date=now, description=description,
                                                     code=code, manifest_hash=manifest_hash,
                                                     signatures=signatures, keys=keys, relpath=relpath, project_counter=project_counter)

                    yield rundir, computation
Пример #17
0
import json
import os
import requests
import time
import sys
import configparser
from mail_sender import MailSender

# Jenkins工作空间目录
workspace = "C:\\Users\\Flyn\\.jenkins\\workspace\\Android App"
# Gradle编译完成生成apk所在的目录
apk_path = workspace + "\\app\\build\outputs\\apk"

mail_sender = MailSender()
configparser = configparser.ConfigParser()
configparser.read(os.path.dirname(os.path.realpath(__file__)) + '\\config.txt')
mail_sender.to_address = configparser.get("Info", "to_address").split(',')
mail_sender.from_address = configparser.get("Info", "from_address")
mail_sender.my_name = configparser.get("Info", "my_name")
mail_sender.password = configparser.get("Info", "password")
mail_sender.smtp_server = configparser.get("Info", "smtp_server")
mail_sender.smtp_server_port = configparser.get("Info", "smtp_server_port")

# 时间格式
date = time.strftime('%Y-%m-%d %H:%M', time.localtime(time.time()))

BRANCH = sys.argv[1]  # 参数
BUILD_TYPE = sys.argv[2]  # 创建类型
FLAVORS = sys.argv[3]  # 渠道

Пример #18
0
import configparser

configparser = configparser.ConfigParser()

configparser.read('api.conf')

url = configparser['DEFAULT']['url']
token = configparser['DEFAULT']['token']
Пример #19
0
import networkx as nx
import configparser as config
import math
import sys

config = config.ConfigParser()
config.read('config/network.cfg')

PE = 'PENode'
Mem = 'MemoryNode'
Bus = 'Bus'
Global = 'DRAM'

PE_sram = float(config.get(PE, 'SRAMsize'))
PE_energy = float(config.get(PE, 'EnergyCost'))
PE_cycle = float(config.get(PE, 'ComputTime'))
Mem_dram = float(config.get(Mem, 'DRAMsize'))
Mem_energy = float(config.get(Mem, 'EnergyCost'))
Mem_cycle = float(config.get(Mem, 'TransferTime'))
Bus_cycle = float(config.get(Bus, 'Latency'))
Bus_energy = float(config.get(Bus, 'EnergyCost'))
Global_dram = float(config.get(Global, 'DRAMsize'))
Global_energy = float(config.get(Global, 'EnergyCost'))
Global_cycle = float(config.get(Global, 'TransferTime'))

# Initialize the graph
# arg[0] = dimension (determine how many arguments are there)
# arg[1] = first argument (row)
# arg[2] = second argument (column)
# arg[3] .....
# Default: Undirected graph
Пример #20
0
#Создаем аппликейшен
app = QtWidgets.QApplication(sys.argv)
#Создаем форму и иницируем графический интерфейс
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()

ui.pushButton_2.setEnabled(False)  # Активируем после введеных личных данных
#ui.btn_toggle_menu.setEnabled(False) # На будущее

# Настройка подключения к БД
global ip, db_path, db_user, db_password  #con
configparser = configparser.RawConfigParser()
configparser.read(r'db_conf.txt')
ip = configparser.get('db-config', 'ip')
db_path = configparser.get('db-config', 'db_path')
db_user = configparser.get('db-config', 'db_user')
db_password = configparser.get('db-config', 'db_password')


# Проверка на правильный ввод данных
def has_cyrillic(text):
    return bool(re.search('[а-яА-Я]', text))


def has_symbols(text):
    return bool(re.search('[0-9]', text))

Пример #21
0
    tags = None
    try:
        opts, args = getopt.getopt(sys.argv[1:], "t:")
    except getopt.GetoptError:
        print("Usage: {0} [-t tags] url [url ...]".format(sys.argv[0]))
        sys.exit(2)

    for opt, arg in opts:
        if opt == "-t":
            tags = arg

    config = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          "jopleet.config")

    configparser = configparser.RawConfigParser()
    configparser.read(config)

    jurl = configparser.get('authentication', 'joplin_url')
    token = configparser.get('authentication', 'token')
    parent_folder = configparser.get('authentication', 'parent_folder')

    ConsumerKey = configparser.get('authentication', 'ConsumerKey')
    ConsumerSecret = configparser.get('authentication', 'ConsumerSecret')
    AccessToken = configparser.get('authentication', 'AccessToken')
    AccessTokenSecret = configparser.get('authentication', 'AccessTokenSecret')

    auth = tweepy.OAuthHandler(ConsumerKey, ConsumerSecret)
    auth.set_access_token(AccessToken, AccessTokenSecret)
    api = tweepy.API(auth)

    for url in args:
Пример #22
0
import json
import configparser

configparser = configparser.ConfigParser()
configparser.read('auto_capture_config.txt')

print(configparser.sections())

ids_str = configparser['content']['webcam_ids']
# print(ids_str)
# print(configparser['content']['img_width'])

print(configparser.get('content', 'webcam_ids'))

v = json.loads(configparser.get('content','webcam_ids'))
Пример #23
0
import os
import subprocess
import time
import random
import configparser

configparser = configparser.RawConfigParser()
configparser.read("config.txt")

#config
f = open('config.txt', 'r')
print(f.read())


class config:
    output = configparser.get("config", "output")
    minimum_seconds = int(configparser.get("config", "minimum_seconds"))
    maximum_seconds = int(configparser.get("config", "maximum_seconds"))
    frequency = configparser.get("config", "frequency")


Tracks = []

for x in range(12):
    Tracks.append(x + 1)

while True:

    Random_Track = random.randint(0, 11)
    Random_Sleep = random.randint(config.minimum_seconds,
                                  config.maximum_seconds)
Пример #24
0
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

from pathlib import Path

PROJECT_PACKAGE = Path(__file__).resolve().parent
BASE_DIR = PROJECT_PACKAGE.parent

import configparser

configparser = configparser.ConfigParser()
configparser.read(str(PROJECT_PACKAGE) + '/local-settings.ini')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '*rc&-m76*hkvo6^d!vx&bjve8r-ou^sd2((p33f%%zx2gdq(hn'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
Пример #25
0
# Bring packages onto path
from sys import path as syspath
from pathlib import Path

syspath.append(Path(__file__).parent.absolute())

# Read the config files & parse for input
import configparser

configparser = configparser.ConfigParser()
config_file_path = str(Path(__file__).parent.absolute()) + "/.config"
configparser.read(config_file_path)

# GLOBAL CONSTANTS to be accessed everywhere
FOLDER_PATH = configparser.get('GENERAL', 'FOLDER_PATH')
EDITOR = configparser.get('GENERAL', 'EDITOR')
Пример #26
0
#!/usr/bin/env python3

import base64
import json
import argparse
import configparser
from sys import stdin, stdout
from urllib.request import build_opener

# user-specific params
configparser = configparser.ConfigParser()
configparser.read('scanner.conf')
config = configparser['BITCOINRPC']
rpc_user = config['username']
rpc_password = config['password']
rpc_host = config['host']
rpc_port = int(config['port'])

auth = base64.encodebytes('{}:{}'.format(
    rpc_user, rpc_password).encode()).decode().replace('\n', '')
url = "http://{}:{}".format(rpc_host, rpc_port)


def rpc_request(method, *params):
    opener = build_opener()
    opener.addheaders = [("Authorization", "Basic %s" % auth)]
    data = {
        "jsonrpc": "1.0",
        "id": "",
        "method": method,
        "params": list(params)
Пример #27
0
    def debug_log(self, line):
        self.connection.debug_log(line)

    def error_log(self, line):
        self.connection.error_log(line)
    
    def update(self):
        err = self.handle_input()
        while err and not self.quitting:
            print("Disconnected from server. Reconnecting.. ")
            self.error_log("Disconnected from server. Reconnecting.. ")
            err = self._init()


if __name__=="__main__":
    parser = parser.SafeConfigParser(allow_no_value=True)
    parser.read(["bot.cfg"])
    server = parser.get("bot","server")
    port = parser.getint("bot","port")
    passw = parser.get("bot","pass")
    user = parser.get("bot","user")
    realname = parser.get("bot","realname")
    nick = parser.get("bot","nick")
    log = parser.get("bot","log")
    debug = parser.getint("bot","debug")
    ssl = parser.getint("bot","ssl")
    bot = IrcBot(server, port, passw, user, realname, nick, log, debug, ssl)
    while not bot.quitting:
        bot.update()
Пример #28
0
 def load_acli_config():
     if os.path.isfile('acli.cfg'):
         configparser.read('acli.cfg')
Пример #29
0
import asyncio
from datetime import datetime
import tkinter.messagebox
import psutil
import socket
from enum import Enum
import configparser
from Alarm import alarm
from Alarm import getIniPath
import os

#Variablen
iniPath = getIniPath()
configparser = configparser.ConfigParser()
configparser.sections()
configparser.read(iniPath)
window = Tk()
logCpu = False
logRam = False
logHdd = False
wasCritical = False
runningProcess = True
alertProcessCount = int(configparser['ALERTVALUES']['alertProcessCount'])
criticalProcessCount = int(configparser['ALERTVALUES']['criticalProcessCount'])
alertRamCount = int(configparser['ALERTVALUES']['alertRamCount'])
criticalRamCount = int(configparser['ALERTVALUES']['criticalRamCount'])
alertHddCount = int(configparser['ALERTVALUES']['alertHddCount'])
criticalHddCount = int(configparser['ALERTVALUES']['criticalHddCount'])
logFilePath = configparser['LOGPATH']['filename']
critical = " Kritisch: "
alert = " Warnung: "
Пример #30
0
# 杯ども、それはかすかな目です!!!
# or i guess miku is a better projected idol than kizuna ai huh
# new rule: v-tubers aren't idols
# plus there's too many of them

import time
from flask import Flask, render_template, request, Response, Markup
import idol
import traceback
import configparser
import logging
from threading import Thread

configparser = configparser.RawConfigParser()
configFilePath = r'config.conf'
configparser.read(configFilePath)

matrixCom = configparser.get('general', 'matrixCom')
matrixType = configparser.get('general', 'matrixType')
musicSource = configparser.get('general', 'musicSource')
dtvSources = configparser.get('general', 'dtvSources').split(',')
sourceNames = configparser.get('general', 'sourceNames').split(',')
numberOfTargets = configparser.get('general', 'numberOfTargets')
projectorLayout = configparser.get('general', 'projectorLayout') # "twos" or "threes"
zones = configparser.get('general', 'zones')
numberOfZones = len(zones.split(','))
zoneNames = configparser.get('general', 'zoneNames').split(',')
targetIPs = configparser.get('general','targetIPs').split(',')

# hook into the logger
logger = idol.logger
Пример #31
0
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys

IGNORED_EXCEPTIONS = (NoSuchElementException, )
TIME_OUT = 30  #30秒

#解析配置
configparser = configparser.ConfigParser()
configparser.read("conf.ini", encoding='utf8')
config = {}
for section in configparser.sections():
    sectionStr = {}
    config[section] = sectionStr
    for option in configparser.options(section):
        sectionStr[option] = configparser.get(section, option)

driver_type = config['driver']['driver']
driver_position = config['driver']['driver_path'] + '\chromedriver.exe'
driver_env = config['driver']['driver_user_dir']

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("start-maximized")
chrome_options.add_argument('--user-data-dir=' + driver_env)
try: