[python-win32] Passing an object to a process

2012-03-14 Thread Tony Cappellini
On Windows XP - I've got a program running which has spawned a process using os.spawnv(). My program has a logger object instantiated that I want to pass to the process that was spawned. I need to log errors seen by the process, to the same logfile that the program uses for logging. I have the

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Preston Landers
Without getting into too philosophical of a discussion, the only sense in which objects can truly move from one process to another is recreating them in the other process. Even fork() makes copies of everything. Have you tried pickle or other techniques of serialization? Not sure offhand if the

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Tim Roberts
Tony Cappellini wrote: On Windows XP - I've got a program running which has spawned a process using os.spawnv(). My program has a logger object instantiated that I want to pass to the process that was spawned. That's impossible. Objects are just memory, and memory cannot be shared between

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Max Slimmer
depends what you mean by share logger object, you might be able to have logger on both apps share a common log file. OTH if you want realtime events, I pass a socket from one app to another and have implemented a proxy dialog so one app writes to the progress dialog proxy and it in turn sends data

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Preston Landers
On Wed, Mar 14, 2012 at 2:55 PM, Tony Cappellini cappy2...@gmail.com wrote: in which objects can truly move from one process to another is recreating them in the other process.  Even fork() makes copies of everything. Recreating an object in another process means it's a different object,

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Max Slimmer
If you are really just logging, use separate loggers/files, sync the clocks, and timestamp records, then merge when you are ready to process if you need timeline related results. On Wed, Mar 14, 2012 at 1:29 PM, Preston Landers pland...@gmail.com wrote: On Wed, Mar 14, 2012 at 2:55 PM, Tony

Re: [python-win32] Passing an object to a process

2012-03-14 Thread Tony Cappellini
Thanks for all the advice. The solution is simple, but neither elegant nor Pythonic. It's a kludge, but will suffice. The process simply opens writes a 1 line log file, then closes it. The process also increments a counter each time the log file is written, and writes the counter value to the