[Twisted-Python] How do I modify sys.path in a .tap file?

Paul Moore pf_moore at yahoo.co.uk
Mon Dec 22 13:10:45 EST 2003


I have an application which needs to modify sys.path, in order to pick
up its configuration file (written in Python, naturally :-)) But I'm
not sure how I do this.

Ideally, I'd like to set an option in the tap config file, so I could
just do

    mktap MyApp --confdir ....

and be able to use config["confdir"] to set "something" which would be
picked up and added to sys.path when I run the tap file with twistd.
But I'm not sure how I could do this.

Subclassing service.MultiService, so that I could set sys.path in
startService(), worked OK, but I'm not sure if that's the best idea. 
Is there another way of doing this sort of thing, that I'd be better
using?

Paul.
-- 
This signature intentionally left blank





More information about the Twisted-Python mailing list