Skip to content

Commit

Permalink
add: logging info
Browse files Browse the repository at this point in the history
  • Loading branch information
imShakil committed Jul 28, 2022
1 parent 197675a commit 2103ae2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bin/autopi
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ import os
import sys
import time
import random
import logging
import subprocess
import configparser

msg_fmt = "[%(asctime)s ] %(levelname)s @ line %(lineno)d: %(message)s"
logging.basicConfig(filename='autopi.log', filemode='w', format=msg_fmt)


if sys.version_info.major < 3:
print("This script runs under python3")
logging.info("This script runs under python3")
sys.exit()

missing_packages = ['scrot', 'python3-tk', 'python3-dev']
Expand All @@ -23,7 +28,7 @@ def packages():
for package in missing_packages:
subprocess.check_call(['apt-get', 'install', '-y', package])
except IOError:
print(IOError)
logging.error(IOError)
sys.exit()


Expand All @@ -48,7 +53,11 @@ running = False

# Config Parse
config = configparser.ConfigParser()
config.read(os.getcwd()+'/config.ini')
try:
config.read('../config.ini')
except Exception as e:
logging.error(e)
sys.exit()


mouse_movement = config.getboolean('MouseMovement', 'allow')
Expand Down

0 comments on commit 2103ae2

Please sign in to comment.