bug fix with file writer
This commit is contained in:
parent
008ae6edf9
commit
b0380be861
42
setup.py
42
setup.py
|
@ -3,21 +3,31 @@ This is a build file for the
|
||||||
"""
|
"""
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
def read(fname):
|
def read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
setup(
|
args = {"name":"data-transport","version":"1.0.0","author":"The Phi Technology LLC","author_email":"info@the-phi.com","license":"MIT","packages":["transport"]}
|
||||||
name = "data-transport",
|
args["keywords"]=['mongodb','couchdb','rabbitmq','file','read','write','s3']
|
||||||
version = "1.0",
|
args["install_requires"] = ['pymongo','numpy','cloudant','pika','boto','flask-session','smart_open']
|
||||||
author = "The Phi Technology LLC",
|
args["url"] = "https://dev.the-phi.com/git/steve/data-transport.git"
|
||||||
author_email = "steve@the-phi.com",
|
|
||||||
license = "MIT",
|
if sys.version_info[0] == 2 :
|
||||||
packages=['transport'],
|
args['use_2to3'] = True
|
||||||
keywords=['mongodb','couchdb','rabbitmq','file','read','write','s3'],
|
args['use_2to3_exclude_fixers']=['lib2to3.fixes.fix_import']
|
||||||
install_requires = ['pymongo','numpy','cloudant','pika','boto','flask-session','smart_open'],
|
setup(**args)
|
||||||
url="https://dev.the-phi.com/git/steve/data-transport.git",
|
# setup(
|
||||||
use_2to3=True,
|
# name = "data-transport",
|
||||||
long_description=read('README.md'),
|
# version = "1.0",
|
||||||
convert_2to3_doctests=['README.md'],
|
# author = "The Phi Technology LLC",
|
||||||
#use_2to3_fixers=['your.fixers'],
|
# author_email = "steve@the-phi.com",
|
||||||
use_2to3_exclude_fixers=['lib2to3.fixes.fix_import'],
|
# 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'],
|
||||||
|
# )
|
||||||
|
|
|
@ -46,7 +46,7 @@ class DiskWriter(Writer):
|
||||||
if 'name' in params:
|
if 'name' in params:
|
||||||
self.name = params['name'];
|
self.name = params['name'];
|
||||||
else:
|
else:
|
||||||
self.name = None
|
self.name = 'out.log'
|
||||||
if os.path.exists(self.path) == False:
|
if os.path.exists(self.path) == False:
|
||||||
os.mkdir(self.path)
|
os.mkdir(self.path)
|
||||||
|
|
||||||
|
@ -71,12 +71,15 @@ class DiskWriter(Writer):
|
||||||
xchar = None
|
xchar = None
|
||||||
if 'xchar' is not None:
|
if 'xchar' is not None:
|
||||||
xchar = params['xchar']
|
xchar = params['xchar']
|
||||||
path = ''.join([self.path,os.sep,label])
|
#path = ''.join([self.path,os.sep,label])
|
||||||
if os.path.exists(path) == False:
|
path = ''.join([self.path,os.sep,self.name])
|
||||||
os.mkdir(path) ;
|
#if os.path.exists(path) == False:
|
||||||
|
# os.mkdir(path) ;
|
||||||
path = ''.join([path,os.sep,self.name])
|
path = ''.join([path,os.sep,self.name])
|
||||||
f = open(path,'a')
|
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.write(row)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue