dir error handling
This commit is contained in:
parent
010334e2c9
commit
563f5c7847
|
@ -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'
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue