I think really integrating them is going to take some work.  Your app wants to 
parse the commandline, trap signals, and run an event loop.  NOX also wants to 
do all of these things. It seems like you'll have to find all the pieces of 
overlapping functionality and pick one implementation and make the other work 
with it.  Without knowing more about your app and what you're looking for from 
NOX, I'm having a hard time thinking of generic advice for doing this.

Except maybe… don't do it if you don't have to.  Depending on how much they 
need to communicate and what kind of data needs to be communicated, I might run 
your application in its own process and write a component for NOX that 
communicates with it (for example by using the NOX messenger component and JSON 
strings, or pickling Python objects and exchanging them between processes, 
etc.). 

-- Murphy

On Feb 8, 2011, at 2:12 PM, George Porter wrote:

> Hello everyone,
> 
> I'd like to integrate NOX into a pre-existing python application, and
> was wondering if you had any suggestions for the best way to proceed.
> My application is quite large, and has a large number of library
> dependencies.  Additionally, it has a main loop that initializes some
> state that can only be done from the main thread (e.g., trapping
> certain signals, parsing the command line, etc).
> 
> My initial thought was to put my code in the "examples" subdirectory
> of the NOX distribution and have it be invoked there.  However, it
> seems like I can't do things like trap those signals.  Additionally,
> some of the library dependencies cause failures (e.g., OptionParser to
> parse the arguments).  BTW my application is not written in
> Twisted--it is just standard single-threaded Python code.
> 
> Is there a "best practice" for hooking NOX into an application without
> having to re-write it?
> 
> Thanks,
> George
> 
> _______________________________________________
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to