<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. </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>
def SetIntegration(self, integrationObject, activeEditor=""):<br>
"""<br>
set the integration object <br>
"""<br>
try:<br>
<br>
except:<br>
print_exc_plus()<br>
return E_FAIL<br>
return S_O<br>
<br>
def print_exc_plus():<br>
""" <br>
Print the usual traceback information, followed by a listing
of<br>
all the local variables in each frame.<br>
"""<br>
logging.error("*"*20)<br>
for m in sys.exc_info():<br>
logging.error(str(m))<br>
logging.error("*"*20)<br>
tb = sys.exc_info( )[2]<br>
while tb.tb_next:<br>
tb = tb.tb_next<br>
stack = [ ]<br>
f = tb.tb_frame<br>
while f:<br>
stack.append(f)<br>
f = f.f_back<br>
stack.reverse( )<br>
traceback.print_exc()<br>
logging.error( "Locals by frame, innermost last")<br>
for frame in stack:<br>
logging.error("Frame %s in %s at line %s" %
(frame.f_code.co_name,<br>
frame.f_code.co_filename,<br>
frame.f_lineno))<br>
for key, value in frame.f_locals.items():<br>
# we must _absolutely_ avoid propagating exceptions, and
str(value)<br>
# COULD cause any exception, so we MUST catch any...:<br>
try:<br>
logging.error("\t%20s = %s"%(key ,str(value)))<br>
except:<br>
logging.error( "<ERROR WHILE PRINTING VALUE>")<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 </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>