Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

改进windows下的兼容性 #1354

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cobra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import traceback
from .log import logger
import sys

try:
from configparser import ConfigParser
Expand All @@ -22,7 +23,10 @@

project_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))

code_path = '/tmp/cobra'
if sys.platform == 'win32':
code_path = sys.path[0]+'/tmp'#在cobra项目文件夹下创建目录
else:
code_path = '/tmp/cobra'
if os.path.isdir(code_path) is not True:
os.mkdir(code_path)

Expand Down
4 changes: 2 additions & 2 deletions cobra/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import re
import subprocess
import logging
import cloghandler
import concurrent_log_handler

# stream handle
#
Expand Down Expand Up @@ -228,7 +228,7 @@ def format(self, record):
logger.addHandler(sh)

# file handle
fh = cloghandler.ConcurrentRotatingFileHandler(logfile, maxBytes=(1048576 * 5), backupCount=7)
fh = concurrent_log_handler.ConcurrentRotatingFileHandler(logfile, maxBytes=(1048576 * 5), backupCount=7)
fh.setFormatter(fh_format)
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
Expand Down