Questions tagged [python-watchdog]

Use this tag with questions related to the Python library Watchdog, a tool to monitor file system events. You should also specify the tag [python] and eventually the version used.

Watchdog is a Python API library and shell utilities to monitor file system events.

See more:

198 questions
44
votes
2 answers

Calling one method from another within same class in Python

I am very new to python. I was trying to pass value from one method to another within the class. I searched about the issue but i could not get proper solution. Because in my code, "if" is calling class's method "on_any_event" that in return should…
kirti
  • 461
  • 1
  • 5
  • 5
13
votes
2 answers

How to run an function when anything changes in a dir with Python Watchdog?

I'm trying to use watchdog to run a sync script whenever anything changes in a dir (except for one specific file). I simply copied the code from the readme (pasted below), which does what it says; log which file has changed. import sys import…
kramer65
  • 39,074
  • 90
  • 255
  • 436
11
votes
7 answers

Python watchdog windows wait till copy finishes

I am using the Python watchdog module on a Windows 2012 server to monitor new files appearing on a shared drive. When watchdog notices the new file it kicks off a database restore process. However, it seems that watchdog will attempt to restore the…
tjmgis
  • 1,429
  • 3
  • 18
  • 39
8
votes
2 answers

Simplest way for PyQT Threading

I have a GUI in PyQt with a function addImage(image_path). Easy to imagine, it is called when a new image should be added into a QListWidget. For the detection of new images in a folder, I use a threading.Thread with watchdog to detect file changes…
user3696412
  • 808
  • 2
  • 7
  • 20
8
votes
0 answers

Watchdog getting events thrice in Python 3

I'm creating a program in Python using Watchdog that watches a set of files and takes actions based on changes. I put the exact example from their site in a file: import sys import time import logging from watchdog.observers import Observer from…
PurkkaKoodari
  • 6,383
  • 5
  • 33
  • 54
8
votes
1 answer

How do I watch a file, not a directory for changes using Python?

The question: How do I watch a file for changes using Python? suggests using watchdog, but I found it was only able to watch a directory, not a file. watchdog-test.py is watchdog's sample script: $ python watchdog-test.py ab_test_res.sh & [1]…
laike9m
  • 14,908
  • 16
  • 92
  • 123
4
votes
1 answer

Python Watchdog process existing files on startup

I have a simple Watchdog and Queue process to monitor files in a directory. Code taken from https://camcairns.github.io/python/2017/09/06/python_watchdog_jobs_queue.html import time from watchdog.events import PatternMatchingEventHandler from…
scottyj
  • 41
  • 2
4
votes
2 answers

How to fix ‘“ERROR: Command errored out with exit status 1:” when trying to install watchdog using pip

I am revisiting the python language and experiencing difficulty setting up my environment. I am using - Mac Mojave (10.14) - python 2.7.10 (packaged with the system) - python 3.7.4 (installed using homebrew) - homebrew 2.1.14 - pip 19.2.3 I…
chronowalker
  • 43
  • 1
  • 1
  • 3
4
votes
0 answers

Python watchdog module duplicate events (edit: was not an watchdog issue)

I am creating a python script that will identify changes to a log file and print some data from the new logs. I use watchdog to create an event handler and everything seems to work fine except from that, I get duplicate events every time I modify…
George Sp
  • 524
  • 3
  • 17
4
votes
2 answers

flask application with watchdog observer

I am seeking for an example for flask-based web application with watchdog observer. More specifically, I want to use the watchdog observer to detect any changes in pre-defined directories and update a web application based on the changes. I can find…
Sungsoo Ha
  • 175
  • 2
  • 12
4
votes
0 answers

Why is Watchdog throwing this OS error?

I am trying to write a daemon to monitor directory changes in Python, and I really could use some help. So far I have tried both inotify and Watchdog. Both packages have thrown massive errors when running their example code on their front pages. Can…
4
votes
1 answer

Python watchdog: How to handle the watched directory being deleted?

I am happily using the watchdog package, specifically PollingObserver, to watch directories for file events. It works great - until the directory I am watching is deleted. What then happens is the code that is polling the directory calls stat() on a…
Jeffrey DeLeo
  • 1,562
  • 11
  • 18
4
votes
0 answers

Python watchdog on network shares right issues

Im using python 2.7 on Windows 7 Enterprise SP1 with watchdog to watch some network shares for file changes. I have to networkshares on the same physical (assumed Linux) host that are connected to two different subfolders. So let's say I connected…
Dschoni
  • 3,192
  • 3
  • 34
  • 61
4
votes
1 answer

Using python-watchdog to monitor a folder, but when I rename a file, I haven't been able to find a way to see the new filename

Renaming a file that is being monitored in watchdog produces a on_moved event trigger. The problem I'm having is that there is no way to tell what the file was moved/renamed to (as the on_moved event trigger also happens when a file was renamed). Is…
Luis F Hernandez
  • 760
  • 1
  • 10
  • 27
4
votes
1 answer

Best practice for watching and reliable uploading files in Python?

I'm building a desktop application for Windows in Python 2.7. The primary function of this application is to watch a folder for new files. Whenever a new file appears in this folder the app uploads it to remote server. The process on the remote…
Warwick
  • 1,125
  • 11
  • 19
1
2 3
13 14