<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Kevin ,<br>
    <br>
    Il 18/08/2011 17:10, Kevin Walzer ha scritto:
    <blockquote
cite="mid:CALJu2A0T9Yjj13+uAhhfOrtC4Q_b_gSmeJrvkM799kikuV3ztg@mail.gmail.com"
      type="cite">Hi all,
      <div><br>
      </div>
      <div>I'm working on a Tkinter app that is being deployed to
        Windows via py2exe for wrapping and InnoSetup for its installer.
        In order to provide a similar scripting capability to the app
        that is present in its Mac version, I've made the app a COM
        server using the examples from python-win32 code base.&nbsp;</div>
      <div><br>
      </div>
      <div>I am running into two issues with the app that I would like
        some clarification on:</div>
      <div><br>
      </div>
      <div>1. What is the best way to register the exe as a COM server?
        I'm using the code from the python-win32 extension to register
        the code dynamically, but on Windows 7 this requires
        administrator privileges--which means that the entire app must
        be run as an administrator (via a flag in py2exe). This works,
        but seems overkill. I understand from the list archives that
        there is no current built-in way to escalate UAC privileges for
        a single function, cf. to register the server. Is there another
        way to register the wrapped exe as a server, i.e. from the
        command line (regsvr32) during the installation phase? <br>
      </div>
    </blockquote>
    For registering the com server we use innosetup with the following
    line<br>
    [Run]<br>
    Filename: "{app}\openclerk.exe"; Parameters: "/regserver";
    WorkingDir: "{app}" ; StatusMsg: "Registering openclerk.exe ..."<br>
    <blockquote
cite="mid:CALJu2A0T9Yjj13+uAhhfOrtC4Q_b_gSmeJrvkM799kikuV3ztg@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>2. I am testing the app via a simple vbscript with a create
        object() call and then running the command exported by the COM
        server. While my app launches, it blocks forever, and then
        eventually the Windows Scripting Host times out with an error
        ("couldn't create ActiveX object"). Any suggestions on how to
        debug this?</div>
    </blockquote>
    <br>
    usually you get this error because you miss some reference into
    py2exe<br>
    the way that we use to trace this error is to try catch all com
    method even the __init__ and use the logging system:<br>
    <br>
    here you get an example:<br>
    <br>
    &nbsp;&nbsp;&nbsp; def SetIntegration(self, integrationObject, activeEditor=""):<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; """<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set the integration object <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; """<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print_exc_plus()<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return E_FAIL<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return S_O<br>
    <br>
    def print_exc_plus():<br>
    &nbsp;&nbsp;&nbsp; """ <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Print the usual traceback information, followed by a listing
    of<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all the local variables in each frame.<br>
    &nbsp;&nbsp;&nbsp; """<br>
    &nbsp;&nbsp;&nbsp; logging.error("*"*20)<br>
    &nbsp;&nbsp;&nbsp; for m in sys.exc_info():<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logging.error(str(m))<br>
    &nbsp;&nbsp;&nbsp; logging.error("*"*20)<br>
    &nbsp;&nbsp;&nbsp; tb = sys.exc_info( )[2]<br>
    &nbsp;&nbsp;&nbsp; while tb.tb_next:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tb = tb.tb_next<br>
    &nbsp;&nbsp;&nbsp; stack = [&nbsp; ]<br>
    &nbsp;&nbsp;&nbsp; f = tb.tb_frame<br>
    &nbsp;&nbsp;&nbsp; while f:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.append(f)<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = f.f_back<br>
    &nbsp;&nbsp;&nbsp; stack.reverse( )<br>
    &nbsp;&nbsp;&nbsp; traceback.print_exc()<br>
    &nbsp;&nbsp;&nbsp; logging.error( "Locals by frame, innermost last")<br>
    &nbsp;&nbsp;&nbsp; for frame in stack:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logging.error("Frame %s in %s at line %s" %
    (frame.f_code.co_name,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    frame.f_code.co_filename,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frame.f_lineno))<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for key, value in frame.f_locals.items():<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # we must _absolutely_ avoid propagating exceptions, and
    str(value)<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # COULD cause any exception, so we MUST catch any...:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logging.error("\t%20s = %s"%(key ,str(value)))<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logging.error( "&lt;ERROR WHILE PRINTING VALUE&gt;")<br>
    <br>
    <br>
    Regards,<br>
    Matteo<br>
    <br>
    <blockquote
cite="mid:CALJu2A0T9Yjj13+uAhhfOrtC4Q_b_gSmeJrvkM799kikuV3ztg@mail.gmail.com"
      type="cite">
      <div> I can find no obvious error in my code and the app does
        start up successfully, which tells me it's registered, but for
        some reason it locks up before it can run its command. (The app
        does pop up a dialog on startup, I don't know if that would have
        any effect or not.)</div>
      <div><br>
      </div>
      <div>Thanks,</div>
      <div>Kevin&nbsp;</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:python-win32@python.org">python-win32@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <p class="avgcert" color="#000000" align="left">Nessun virus nel
        messaggio.<br>
        Controllato da AVG - <a moz-do-not-send="true"
          href="http://www.avg.com">www.avg.com</a><br>
        Versione: 10.0.1392 / Database dei virus: 1520/3841 - Data di
        rilascio: 17/08/2011</p>
    </blockquote>
    <br>
  </body>
</html>