Skip to main content

System tray app and task runner used for watching files

Project description

Data Watcher

The Data Watcher class is a PyQt system tray application with three main components:

  • Ability to specify a background task to run (i.e. watchdog observer)
  • Ability to manually upload a file using the context menu of the tray icon.
  • Logging display

Example Usage

Using the watchdog library combined with the FileUploadDialog class, you can create a program that watches a directory for new files and runs any tasks in the parse_file function.

You can use the pyinstaller library to create a frozen exe to distribute.

import logging
import sys
from pathlib import Path

from import FileSystemEventHandler
from watchdog.observers import Observer

from data_watcher import DataWatcher, FileUploadDialog

logger = logging.getLogger()
icon_path = Path("icon.png").absolute()
app_name = "Data Logger"

# Main parsing method
def parse_file(path: Path):

class CreatedHandler(FileSystemEventHandler):
    def on_created(self, event):
        if not event.is_directory and ".txt" in event.src_path:

def init_watcher():
    event_handler = CreatedHandler()
    observer = Observer()
        observer.schedule(event_handler, path=str(Path.cwd()), recursive=False)
    except FileNotFoundError:
        logging.error('Directory not found')'Watcher Started')

    return observer

def upload_file():
        allowed_files_filter='Text Files (*.txt);;All Files (*)'

app = DataWatcher(


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

data_watcher_tray-0.0.1-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page