using correct dirname when adding cwd to sys.path in wakatime-cli.py
fixes to wakatime package to allow directly importing. don't add duplicate handlers to logger in log.py.
This commit is contained in:
parent
08010e86fe
commit
02d54b76f3
3 changed files with 9 additions and 2 deletions
|
@ -14,7 +14,7 @@ from __future__ import print_function
|
|||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath(__file__))
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import wakatime
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -33,6 +33,7 @@ except ImportError:
|
|||
from urllib.error import HTTPError
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from .log import setup_logging
|
||||
from .project import find_project
|
||||
try:
|
||||
|
@ -52,6 +53,10 @@ class FileAction(argparse.Action):
|
|||
|
||||
|
||||
def parseArguments(argv):
|
||||
try:
|
||||
sys.argv
|
||||
except AttributeError:
|
||||
sys.argv = argv
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Wakati.Me event api appender')
|
||||
parser.add_argument('--file', dest='targetFile', metavar='file',
|
||||
|
|
|
@ -63,6 +63,9 @@ class JsonFormatter(logging.Formatter):
|
|||
|
||||
|
||||
def setup_logging(args, version):
|
||||
logger = logging.getLogger()
|
||||
if len(logger.handlers) > 0:
|
||||
return logger
|
||||
logfile = args.logfile
|
||||
if not logfile:
|
||||
logfile = '~/.wakatime.log'
|
||||
|
@ -77,7 +80,6 @@ def setup_logging(args, version):
|
|||
plugin=args.plugin,
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(handler)
|
||||
level = logging.INFO
|
||||
if args.verbose:
|
||||
|
|
Loading…
Reference in a new issue