Python command line custom arguments

I am currently working on a python program that runs as a Windows service using win32service and win32serviceutil. The service works as it should and even after using py2exe, everything is fine (the service monitors the target folders and automatically creates new FTP files for the specified FTP location). However, I would like to add some command line arguments (in addition to installing, uninstalling, starting, stopping, etc.) to specify local and FTP directories. The only documentation on this is what I found: http://www.py2exe.org/old/

"Optionally, you can specify the 'cmdline-style' attribute for py2exe, with valid values ​​being" py2exe "(default)," pywin32 ", or" custom "." py2exe "indicates a traditional command line always supported by py2exe." pywin32 "supports the same command line arguments as pywin32 support (i.e. the same arguments that are supported when starting a service from a .py file)" custom "means that your module must provide" HandleCommandLine ", a function that responds for handling the entire command line. "

Any help would be appreciated in getting directions in the right direction. Please let me know if any code is needed for clarity.

Thanks Zach

+6
python py2exe windows-services
source share
1 answer

here is a good example of how to make a service using the custom method HandleCommandLine classmethod is part of the pyro, but has no dependencies on pyro, but rather an utility of the "abstract base class", which you can subclass and get the service with minimal fuss, just by installing a few things in your subclass. For your specific needs, you can use it as a template for copying and editing to get the right command line!

+3
source share

All Articles