fix batchfile path
This commit is contained in:
parent
ad7d3d1949
commit
79b508eb29
|
@ -102,6 +102,7 @@ def writesentence(tmodel, args_sen, args_out, args_over, args_len):
|
|||
|
||||
# functions for directory:
|
||||
def dir_list(directory):
|
||||
"fetch list of text files from a directory"
|
||||
# create a list of files to concatenate:
|
||||
matches = []
|
||||
if os.path.isdir(directory) is True:
|
||||
|
@ -116,10 +117,11 @@ def dir_list(directory):
|
|||
return matches # returns a LIST of filenames
|
||||
|
||||
|
||||
# feed this one the matches list:
|
||||
def dir_cat(matchlist, batchfile):
|
||||
# feed this the matches list:
|
||||
def dir_cat(matchlist, bulkfile):
|
||||
"takes a list of files, concatenates their contents into a single file"
|
||||
# concatenate into batchfile.txt:
|
||||
with open(batchfile, "w") as outfile:
|
||||
with open(bulkfile, "w") as outfile:
|
||||
for fname in matchlist:
|
||||
try:
|
||||
with open(fname, encoding="utf-8") as infile:
|
||||
|
|
|
@ -147,7 +147,8 @@ def main():
|
|||
elif args.directory:
|
||||
matchlist = dir_list(args.infile)
|
||||
# place batchfile.txt in user-given directory:
|
||||
batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt"
|
||||
#batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt"
|
||||
batchfile = args.infile + os.path.sep + "batchfile.txt"
|
||||
dir_cat(matchlist, batchfile)
|
||||
text = read(batchfile)
|
||||
os.unlink(batchfile)
|
||||
|
@ -167,9 +168,10 @@ def main():
|
|||
elif args.directory:
|
||||
matchlist = dir_list(args.infile)
|
||||
# place batchfile.txt in user-given directory:
|
||||
batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt"
|
||||
batchfile = args.infile + os.path.sep + "batchfile.txt"
|
||||
dir_cat(matchlist, batchfile)
|
||||
text = read(batchfile)
|
||||
os.unlink(batchfile)
|
||||
# or normal:
|
||||
else:
|
||||
text = read(args.infile)
|
||||
|
@ -209,9 +211,10 @@ def main():
|
|||
elif args.directory:
|
||||
matchlist = dir_list(args.infile)
|
||||
# place batchfile.txt in user-given directory:
|
||||
batchfile = os.path.dirname(args.infile) + os.path.sep + "batchfile.txt"
|
||||
batchfile = args.infile + os.path.sep + "batchfile.txt"
|
||||
dir_cat(matchlist, batchfile)
|
||||
text = read(batchfile)
|
||||
os.unlink(batchfile)
|
||||
# or local:
|
||||
else:
|
||||
text = read(args.infile)
|
||||
|
|
2
setup.py
2
setup.py
|
@ -9,7 +9,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|||
|
||||
setup(
|
||||
name="mkv-this",
|
||||
version="0.2.0",
|
||||
version="0.2.1",
|
||||
description="cli wrapper for markovify: take a text file or URL, markovify, save the results.",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
|
|
Loading…
Reference in New Issue