Watchdog Ignore Pattern
I tried working with other posts on here about this, but couldn't get it to work. I'm a newbie with Python. I need help with ignore_pattern. I'm uploading images to a folder and te
Solution 1:
Does event.src_path
returns a string? If so you can use the startswith
method of the string class to skip over the images you don't want.
For example:
elif event.event_type == 'created':
# Take any action here when a file is first created.
print(event.src_path)
# Check if this filename starts with "__" and execute the next block
if not event.src_path.startswith('__'):
img = Image.open(event.src_path)
for result in engine.classify_with_image(img, top_k=3):
print('---------------------------')
print(labels[result[0]])
print('Score : ', result[1])
# else do nothing
Post a Comment for "Watchdog Ignore Pattern"