<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Such a change should not cause the entire client to fail.&nbsp; Can you try<br>
running the VenueClient from the command line and see what you get?<br>
<br>
cd \program files\agtk-3\bin<br>
venueclient3.py<br>
<br>
Tom<br>
<br>
<br>
On 4/23/07 10:14 AM, Nicolas Bertrand wrote:
<blockquote cite="mids62cdb76.081@wpo.nerc.ac.uk" type="cite">
  <pre wrap="">Hi Thomas,

A fuller account of the symptoms.

The machine was not displaying any incoming video streams. A problem noticed on a few other older dell optiplex machines. I shut down the venue client and copied the patch processmanager.py file (see attached) as the routine procedure when seeing that problem. The client does not launch anymore at all. :-s 

Nic

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">"Thomas D. Uram" <a class="moz-txt-link-rfc2396E" href="mailto:turam@mcs.anl.gov">&lt;turam@mcs.anl.gov&gt;</a> 04/23 3:42 pm &gt;&gt;&gt;
        </pre>
      </blockquote>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->Hi Nic:

The only problem I see is a failure to connect to the Jabber text service
at one time last week, when there was a problem with the server, and
an error using the AGSC bridge.

Did you encounter some other problem?

Tom


On 4/23/07 4:16 AM, Nicolas Bertrand wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi,

We are experiencing a problem launching the AG client on a winxp sp2 box. see attached logs. 

Any ideas?

Nic










  
    </pre>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
  <pre wrap="">
<hr size="4" width="90%">
#-----------------------------------------------------------------------------
# Name:        ProcessManager.py
# Purpose:     
# Created:     2003/08/02
# RCS-ID:      $Id: ProcessManager.py,v 1.11 2006/05/10 20:34:14 turam Exp $
# Copyright:   (c) 2002-2003
# Licence:     See COPYING.txt
#-----------------------------------------------------------------------------
"""
"""
__revision__ = "$Id: ProcessManager.py,v 1.11 2006/05/10 20:34:14 turam Exp $"

import win32api
import win32con
import win32event
import win32process
from AccessGrid import Log

log = Log.GetLogger(Log.ProcessManager)

class ProcessManager:
    def __init__(self):
        self.processes = []
        self.threadid = dict()
        
    def WaitForChildren(self,callback):
        log.warn('ProcessManager callback not yet implemented on Windows')

    def StartProcess(self, command, arglist, detached = 1, maxWait = 20):
        """
        Start a new process.

        @param command : the name of the command to be started. It can
        either be a full pathname or a command name to be found on the
        default path.
        
        @param arglist : is a list of the arguments to the command.

        @param detached : a flag indicating whether this process
        should be run detached or the process manager should wait for
        it to complete execution to return.
        
        @type command: string
        @type arglist: list of strings
        @type detached: integer
        """
        if command.find(" ") != -1:
                command = '"' + command + '"'
        cmdline = command
        for arg in arglist:
            arg = str(arg)
            if arg.find(" ") != -1:
                #
                # If there are spaces, quote the arg
                #
                arg = '"' + arg + '"'

            cmdline += " " + arg

        try:

            startup_info = win32process.STARTUPINFO()

            log.debug("Creating process: %s", cmdline)

            info = win32process.CreateProcess(
                None,                   # AppName
                cmdline,                # Command line
                None,                   # Process security
                None,                   # Thread security
                0,                      # Inherit handles? 
                win32con.NORMAL_PRIORITY_CLASS|win32con.CREATE_NO_WINDOW,
                None,                   # New environment
                None,                   # Current directory
                startup_info)

            log.debug("Create process returns: %s", info)

            pHandle = info[0]
            
            self.processes.append(pHandle)
            self.threadid[pHandle] = info[3]

            if not detached:
                pHandle = info[0]
                wTime = 0
                tIncr = 1
                # We have to wait for it to finish
                exitCode = win32process.GetExitCodeProcess(pHandle)
                while exitCode == 259 and wTime &lt; maxWait:
                    exitCode = win32process.GetExitCodeProcess(pHandle)
                    time.sleep(tIncr)
                    wTime = wTime + tIncr
                else:
                    # Gotta kill it, sigh
                    self.TerminateProcess(pHandle)
                retval = exitCode
            else:
                retval = pHandle
                
        except win32process.error, e:
            log.exception("process creation failed: %s", e)
            retval = None

        return retval

    def TerminateAllProcesses(self):
        """
        Cleanly shutdown all processes this manager has created.
        """
        # Use a copy of the process list
        processList = self.processes[:]
        
        for phandle in processList:
            try:
                self.TerminateProcess(phandle)
            except Exception, e:
                log.exception("couldn't terminate process %s: %s", phandle, e)
               
        self.processes = []
        self.threadid = dict()

    def TerminateProcess(self, pid):
        """
        Cleanly shutdown the specified process this manager has created.

        @param pid: the id of the process to terminate.
        @type pid: string? integer?
        """
        terminated = 0
        try:
            ret = 0
            win32api.PostThreadMessage(self.threadid[pid], 18, 0, 0)
            ret = win32event.WaitForSingleObject(pid, 500 )
            if ret == win32event.WAIT_OBJECT_0:
                terminated = 1
            else:
                log.warn("Couldn't terminate process %s cleanly (%s)", pid, str(ret))
        except win32process.error,e:
            log.exception("couldn't shutdown process %s: %s", pid, e)

        if not terminated:
            try:
                win32process.TerminateProcess(pid, 0)
                self.processes.remove(pid)
            except win32process.error, e:
                log.exception("couldn't terminate process %s: %s", pid, e)
            
        del self.threadid[pid]

    def KillAllProcesses(self):
        """
        Kill all processes this manager has created.

        @warning: this is not a clean shutdown, but a forced shutdown
        that may result in system cruft.
        """
        # Placeholder to remind implementor 
        # to operate on a copy of the list
        # to avoid skipping procs
        #processList = self.processes[:]
        self.TerminateAllProcesses()

    def KillProcess(self, pid):
        """
        Kill a single process this manager has created.

        @warning: this is not a clean shutdown, but a forced shutdown
        that may result in system cruft.
        
        @param pid: the id of the process to terminate.
        @type pid: string? integer?
        """
        self.TerminateProcess(pid)

    def ListProcesses(self):
        """
        Return a list of process id's for this process manager.
        @returns: a list of process id's
        """
        return self.processes

if __name__ == "__main__":
    import time
    mgr = ProcessManager()

    try:
        mgr.StartProcess("notepad", [r"\boot.ini"])
    except Exception, e:
        print "Exception starting process: ", e

    try:
        print mgr.ListProcesses()
    except Exception, e:
        print "Exception listing processes: ", e

    time.sleep(5)

    try:
        mgr.TerminateAllProcesses()
    except Exception, e:
        print "Exception terminating processes: ", e

    try:
        mgr.StartProcess("notepad", [r"\boot.ini"], detached = 0)
    except Exception, e:
        print "Exception with non-detached process: ", e
    
  </pre>
</blockquote>
</body>
</html>