From daaafedb45a7e09964f62f13fb37ff195417b525 Mon Sep 17 00:00:00 2001 From: Tony DiCola Date: Tue, 10 Feb 2015 22:48:20 -0800 Subject: [PATCH] Simplify running module to fix stdout buffering issue with supervisor. --- Adafruit_Video_Looper/__init__.py | 4 ++-- Adafruit_Video_Looper/video_looper.py | 2 +- setup.py | 3 +-- video_looper.conf | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Adafruit_Video_Looper/__init__.py b/Adafruit_Video_Looper/__init__.py index ecd4450..139597f 100644 --- a/Adafruit_Video_Looper/__init__.py +++ b/Adafruit_Video_Looper/__init__.py @@ -1,2 +1,2 @@ -# Import main program. -from .video_looper import main + + diff --git a/Adafruit_Video_Looper/video_looper.py b/Adafruit_Video_Looper/video_looper.py index 1c8078c..fd6c5a3 100644 --- a/Adafruit_Video_Looper/video_looper.py +++ b/Adafruit_Video_Looper/video_looper.py @@ -214,7 +214,7 @@ class VideoLooper(object): # Main entry point. -def main(): +if __name__ == '__main__': print('Starting Adafruit Video Looper.') # Default config path to /boot. config_path = '/boot/video_looper.ini' diff --git a/setup.py b/setup.py index 1a1750f..a2fbaf2 100644 --- a/setup.py +++ b/setup.py @@ -10,5 +10,4 @@ setup(name = 'Adafruit_Video_Looper', license = 'GNU GPLv2', url = 'https://github.com/adafruit/pi_video_looper', install_requires = ['pyudev'], - packages = find_packages(), - entry_points = {'console_scripts': ['video_looper = Adafruit_Video_Looper:main']}) + packages = find_packages()) diff --git a/video_looper.conf b/video_looper.conf index df52b4e..b769d4e 100644 --- a/video_looper.conf +++ b/video_looper.conf @@ -1,7 +1,7 @@ # Supervisord configuration to run video looper at boot and # ensure it runs continuously. [program:video_looper] -command=video_looper +command=python -u -m Adafruit_Video_Looper.video_looper autostart=true autorestart=unexpected startsecs=5