[Twisted-Python] Newbie question: How to reference the "__main__"

Iap, Singuan iap_yeh at abit.com.tw
Sun Oct 3 22:16:54 EDT 2004


I have a work-around like this:

import __main__
__main__.config=Configuration()

And  access it in other modules by:

import __main__
config=__main__.config

But I don't think that is a good idea.
There must be more simple and extensible way, I guess.

Iap, Singuan


-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com]On Behalf Of Yun Mao
Sent: Friday, October 01, 2004 11:33 PM
To: Twisted general discussion
Subject: Re: [Twisted-Python] Newbie question: How to reference the
"__main__"


but the sys.argv[1:] is going to be twistd's argument, including
"-noy","xxx.tac", etc. right? it isn't exactly what he wanted, is it?

Yun


On Fri, 1 Oct 2004, Itamar Shtull-Trauring wrote:

> On Fri, 2004-10-01 at 05:40, Iap, Singuan wrote:
>
> > In server.py
> > ----------------------------------------
> > config=Configuration()
> somewhere.MyObject.addConfig(config)
>
> and then MyObject can access the config.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>

_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list