From b0380be86117a434102b260177096def98d6a998 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Sun, 1 Dec 2019 21:23:54 -0600 Subject: [PATCH] bug fix with file writer --- setup.py | 42 ++++++++++++++++++++++++++---------------- transport/disk.py | 15 +++++++++------ 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index df614a5..fbcde4c 100644 --- a/setup.py +++ b/setup.py @@ -3,21 +3,31 @@ This is a build file for the """ from setuptools import setup, find_packages import os +import sys def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() -setup( - name = "data-transport", - version = "1.0", - author = "The Phi Technology LLC", - author_email = "steve@the-phi.com", - license = "MIT", - packages=['transport'], - keywords=['mongodb','couchdb','rabbitmq','file','read','write','s3'], - install_requires = ['pymongo','numpy','cloudant','pika','boto','flask-session','smart_open'], - url="https://dev.the-phi.com/git/steve/data-transport.git", - use_2to3=True, - long_description=read('README.md'), - convert_2to3_doctests=['README.md'], - #use_2to3_fixers=['your.fixers'], - use_2to3_exclude_fixers=['lib2to3.fixes.fix_import'], - ) +args = {"name":"data-transport","version":"1.0.0","author":"The Phi Technology LLC","author_email":"info@the-phi.com","license":"MIT","packages":["transport"]} +args["keywords"]=['mongodb','couchdb','rabbitmq','file','read','write','s3'] +args["install_requires"] = ['pymongo','numpy','cloudant','pika','boto','flask-session','smart_open'] +args["url"] = "https://dev.the-phi.com/git/steve/data-transport.git" + +if sys.version_info[0] == 2 : + args['use_2to3'] = True + args['use_2to3_exclude_fixers']=['lib2to3.fixes.fix_import'] +setup(**args) +# setup( +# name = "data-transport", +# version = "1.0", +# author = "The Phi Technology LLC", +# author_email = "steve@the-phi.com", +# license = "MIT", +# packages=['transport'], +# keywords=['mongodb','couchdb','rabbitmq','file','read','write','s3'], +# install_requires = ['pymongo','numpy','cloudant','pika','boto','flask-session','smart_open'], +# url="https://dev.the-phi.com/git/steve/data-transport.git", +# use_2to3=True, +# long_description=read('README.md'), +# convert_2to3_doctests=['README.md'], +# #use_2to3_fixers=['your.fixers'], +# use_2to3_exclude_fixers=['lib2to3.fixes.fix_import'], +# ) diff --git a/transport/disk.py b/transport/disk.py index 5186698..d110f23 100644 --- a/transport/disk.py +++ b/transport/disk.py @@ -46,7 +46,7 @@ class DiskWriter(Writer): if 'name' in params: self.name = params['name']; else: - self.name = None + self.name = 'out.log' if os.path.exists(self.path) == False: os.mkdir(self.path) @@ -71,12 +71,15 @@ class DiskWriter(Writer): xchar = None if 'xchar' is not None: xchar = params['xchar'] - path = ''.join([self.path,os.sep,label]) - if os.path.exists(path) == False: - os.mkdir(path) ; + #path = ''.join([self.path,os.sep,label]) + path = ''.join([self.path,os.sep,self.name]) + #if os.path.exists(path) == False: + # os.mkdir(path) ; path = ''.join([path,os.sep,self.name]) f = open(path,'a') - row = self.format(row,xchar); + if isinstance(row,object): + row = json.dumps(row) + #row = self.format(row,xchar); f.write(row) f.close() - \ No newline at end of file +