[Twisted-Python] Use of 'twistd' utility with command-line arguments
Valeriy Pogrebitskiy
vpogrebi at verizon.net
Fri Oct 2 12:14:19 EDT 2009
Thank you!
I still disagree with the following statement:
> While this is a reasonable expectation, twistd does quite a lot and
> it wouldn't be quite right to pass on all the arguments in a flat
> list the way Python does.
Something can be done about that. One possible approach could be to
use two argument lists (one - 'twistd' arguments, second -
application's arguments) and enforce following rule(s):
- all arguments that follow after 'twistd' but before Python file name
(*.py) are considered as 'twistd' arguments (loaded into <twistdArgs>
list;
- all arguments that follow Python file name (*.py) are considered as
Python application's arguments (loaded into <appArgs> list and get
passed to that application)
Thus, it should be possible to execute following commands:
twistd <twistd_args> *.py <app_args>
Using this approach, it should be simple enough (at least - logically)
to allow passing arguments to an application. Of course, this would
also limit "duplicate" arguments (same argument appearing in both
lists) - due to 'getopt' limitations... But if these rules and
limitations are well documented - developers should be able to work
around this problem.
I suggest that Twisted dev. team looks into implementing this...
Kind regards,
Valeriy Pogrebitskiy
vpogrebi at verizon.net
On Oct 1, 2009, at 4:55 PM, Glyph Lefkowitz wrote:
> On Thu, Oct 1, 2009 at 2:17 PM, Valeriy Pogrebitskiy <vpogrebi at verizon.net
> > wrote:
> I came across some problem using 'twistd' utility - that I would not
> have expected from it. The problem is - using 'twistd' to start
> application that requires command-line arguments. In other words, I
> would expect that 'twistd' passes command-line arguments to Python
> application - just as Python does.
>
> While this is a reasonable expectation, twistd does quite a lot and
> it wouldn't be quite right to pass on all the arguments in a flat
> list the way Python does.
>
> My question is: how is it possible to use 'twistd' to start
> applications that do require command-line arguments? Does anyone
> have suggestions?
>
> twistd doesn't do this for scripts passed with the '-y' option.
> Those are supposed to be fully-formed configuration files; the
> options are present in the file itself.
>
> However, it's fairly straightforward to get what you want. Instead
> of writing a python configuration file, write a plug-in for twistd.
> The technique for doing so is documented here:
>
> <http://twistedmatrix.com/projects/core/documentation/howto/tap.html>
>
> Hope this helps.
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091002/a1007c89/attachment.htm
More information about the Twisted-Python
mailing list