Hi Kevin,
run this script and it will be registered for debug ..

run the win32traceutil.py as mentioned in the following link :
http://www.boscolini.eu/Boscolini/index.php?option=com_content&view=article&id=62%3Apython-win32debug-tutorial&catid=38%3Aprogramming&Itemid=55&lang=en <http://www.boscolini.eu/Boscolini/index.php?option=com_content&view=article&id=62%3Apython-win32debug-tutorial&catid=38%3Aprogramming&Itemid=55&lang=en>

now you get the trace in the win32traceutil.py .. so you can use print to debug your code

I do not know what the quickwhoApp dose, but I think that if you call the mainloop method all the events are stopped there so you are not able to access other method ..
if you send me the code I can give a look at ..


Regards,
Matteo


from quickwho_main import quickwhoApp
import time
import tempfile
from win32com.server.exception import COMException
import winerror
import win32com.server.register

#expose basic functionality to COM
class QuickWho_Domain:
  _public_methods_ = ['GetDomain']
  _reg_progid_ = 'QuickWho.Application'
  _reg_clsid_= '{9F825846-F10B-47DD-91E8-88DA93C1A05E}'


  def GetDomain(self, domain):
      try:
         app.searchfield.delete(0, 'end')
         app.searchfield.insert(0, str(domain))
         app.getInfo()
         time.sleep(1)
         alltext=app.getData()
         tempfile = tempfile.gettempdir()+ '/urltext.txt'
         data = open(tempfile, 'r')
         finaltext = data.read()
         data.close()
         return finaltext
      except Exception ,ex:
          exMsg='Unable to retrieve domain data '+str(ex)
          raise COMException(desc=exMsg,
                            scode=winerror.E_FAIL)

if __name__=="__main__":
    print "*"*20
    import sys
    import win32com.server.register
    sys.argv.append('--debug')
    win32com.server.register.UseCommandLine(QuickWho_Domain)
    print "*"*20

try:
    app = quickwhoApp(None)
    app.mainloop()
except Exception ,ex:
    print "error !! " + str(ex)

Il 20/08/2011 05:29, Kevin Walzer ha scritto:
**
For registering the com server we use innosetup with the following line
[Run]
Filename: "{app}\openclerk.exe"; Parameters: "/regserver"; WorkingDir: "{app}" ; StatusMsg: "Registering openclerk.exe ..."
---
I’ve used a variation of this techinque, it seems to work fine. Thanks.
usually you get this error because you miss some reference into py2exe
the way that we use to trace this error is to try catch all com method even the __init__ and use the logging system:
----
I haven’t been able to figure out how to integrate your example into my own code. The COM/py2exe integration is wholly opaque to me. Here is my code, can you or anyone else suggest what I might be doing wrong?
from quickwho_main import quickwhoApp
import time
import tempfile
from win32com.server.exception import COMException
import winerror
import win32com.server.register
#expose basic functionality to COM
class QuickWho_Domain:
  _public_methods_ = ['GetDomain']
  _reg_progid_ = 'QuickWho.Application'
  _reg_clsid_= '{9F825846-F10B-47DD-91E8-88DA93C1A05E}'
  def GetDomain(self, domain):
      try:
         app.searchfield.delete(0, 'end')
         app.searchfield.insert(0, str(domain))
         app.getInfo()
         time.sleep(1)
         alltext=app.getData()
         tempfile = tempfile.gettempdir()+ '/urltext.txt'
         data = open(tempfile, 'r')
         finaltext = data.read()
         data.close()
         return finaltext
      except:
          raise COMException(desc='Unable to retrieve domain data',
                            scode=winerror.E_FAIL)
try:
  win32com.server.register.RegisterClasses(QuickWho_Domain)
except:
  pass
app = quickwhoApp(None)
app.mainloop()
The idea is to use the COM method (GetDomain) to drive the app’s UI (which in turn fires to external executables via subprocess), parse the data, display it in the GUI , and then return the data to the calling application. Is this how COM is supposed to work? This is how the app works on the Mac in responding to AppleScript calls. Perhaps it’s not the right mechanism for Windows, although I don’t know of a better one that can be accessed from the MS desktop scripting languages, cf. VBScript. Suggestions are appreciated. I’m about to give up on this, as I can’t grok it.
--Kevin
------------------------------------------------------------------------

Nessun virus nel messaggio.
Controllato da AVG - www.avg.com <http://www.avg.com>
Versione: 10.0.1392 / Database dei virus: 1520/3844 - Data di rilascio: 19/08/2011


_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to