dir error handling

This commit is contained in:
mouse 2020-04-21 12:58:26 -03:00
parent 010334e2c9
commit 563f5c7847
2 changed files with 10 additions and 6 deletions

View File

@ -52,11 +52,15 @@ def main():
#create a list of files to concatenate:
matches = []
for root, dirnames, filenames in os.walk(args.indir):
for filename in filenames:
if filename.endswith(('.txt', '.org', '.md')):
matches.append(os.path.join(root, filename))
if os.path.isdir(args.indir) is True:
for root, dirnames, filenames in os.walk(args.indir):
for filename in filenames:
if filename.endswith(('.txt', '.org', '.md')):
matches.append(os.path.join(root, filename))
else:
print('error: please enter a valid directory')
sys.exit()
# place batchfile.txt in user-given directory:
batchfile = os.path.dirname(args.indir) + os.path.sep + 'batchfile.txt'

View File

@ -7,7 +7,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name='mkv-this',
version='0.1.26',
version='0.1.27',
description='cli wrapper for markovify: take a text file, markovify, output the results to a text file.',
long_description=long_description,
long_description_content_type='text/markdown',