teddbug-s / watchdog_plus_old Goto Github PK
View Code? Open in Web Editor NEWA python package written on top of WatchDog to monitor multiple directories in background and on system start-up.
A python package written on top of WatchDog to monitor multiple directories in background and on system start-up.
from watchdog_plus.managers import ObserverManager, StartMethods
paths = [
"/hddisk/ttt/monitor/1",
"/hddisk/ttt/monitor/2"
]
manager = ObserverManager() # initiate the manager
# you can optionally provide names for each of the observers but
# names are also auto generated using the last directory name lower cased
manager.create_observers(paths)
# starting the observers
manager.start_observers(
names=[name.split('/')[-1].lower() for name in paths],
start_method=StartMethods.THREAD # use threading
)
# you can simply just supply the names of only the observers you want to start
I got error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
from watchdog_plus.managers import ObserverManager, StartMethods
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/managers/__init__.py", line 1, in <module>
from .observer_manager import ObserverManager, StartMethods
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/managers/observer_manager.py", line 31, in <module>
from ..handlers import EventHandler
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/__init__.py", line 1, in <module>
from .event_handler import EventHandler
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/event_handler.py", line 35, in <module>
from .logger import EventLogger
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/logger/__init__.py", line 1, in <module>
from .event_logger import EventLogger
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/logger/event_logger.py", line 57
if changes := key.get(name, []):
^
SyntaxError: invalid syntax
Thanks
from watchdog_plus.managers import ObserverManager, StartMethods
paths = [
"/hddisk/ttt/monitor/1",
"/hddisk/ttt/monitor/2"
]
manager = ObserverManager() # initiate the manager
# you can optionally provide names for each of the observers but
# names are also auto generated using the last directory name lower cased
manager.create_observers(paths)
# starting the observers
manager.start_observers(
names=[name.split('/')[-1].lower() for name in paths],
start_method=StartMethods.THREAD # use threading
)
# you can simply just supply the names of only the observers you want to start
I got error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
from watchdog_plus.managers import ObserverManager, StartMethods
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/managers/__init__.py", line 1, in <module>
from .observer_manager import ObserverManager, StartMethods
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/managers/observer_manager.py", line 31, in <module>
from ..handlers import EventHandler
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/__init__.py", line 1, in <module>
from .event_handler import EventHandler
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/event_handler.py", line 35, in <module>
from .logger import EventLogger
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/logger/__init__.py", line 1, in <module>
from .event_logger import EventLogger
File "/hddisk/ttt/monitor/watchdog_plus/watchdog_plus/handlers/logger/event_logger.py", line 57
if changes := key.get(name, []):
^
SyntaxError: invalid syntax
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.