<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hey guys,<br>
    <br>
    just one idea from a problem I had:<br>
    Not succeeding to call ACCESS via pywin32 in the same way I
    succeeded to call EXCEL I learned that not all 32bit versions of
    Office applications provide a suitable 64bit proxy as part of their
    COM interface. I do not know which bitness your Office has but you
    may want to check if this is related to your problem?<br>
    <br>
    You may refer to the mailing list archive topic "Issue with
    PythonCOM - Application.Run does not work for Access.Application"
    from Sep-Nov 2021. Reference there is the following article:<br>
    <a href="https://code.activestate.com/lists/python-win32/12574">Re:
      [python-win32] Makepy for Access on Win7 « python-win32 «
      ActiveState List Archives</a><br>
    <br>
    Regards<br>
    Christoph<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 31.05.2023 um 22:44 schrieb Martín
      Trujillo Raddatz:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMbzi=B0Gwx9QF=3X86SyWUFJaGDGuLJ7xFrwcTom8is6QtYNg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Thanks! 
        <div>Finally the problem is Word app, i try repair and
          reinstall, din not work.</div>
        <div>its seems that a virus may be affecting it, we are now
          moving the scripts to other machine ir orden to determine if 
          the proble is Word or other thing.</div>
        <div><br>
        </div>
        <div><b><font size="2" face="tahoma, sans-serif">----------------------------------------</font></b>
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr"><b><font size="2" face="tahoma, sans-serif">Martín
                    Trujillo Raddatz         <br>
                    Puerto Montt - Chile            <br>
                    Teléfono: +56 9 96427814 </font></b>
                <div><b><font size="2" face="tahoma, sans-serif">----------------------------------------</font></b></div>
              </div>
            </div>
          </div>
          <br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">El mar, 30 may 2023 a las
          17:29, Steven Manross (<<a href="mailto:steven@manross.net"
            moz-do-not-send="true" class="moz-txt-link-freetext">steven@manross.net</a>>)
          escribió:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div class="msg1117567234504642283">
            <div style="overflow-wrap: break-word;" lang="EN-US">
              <div class="m_1117567234504642283WordSection1">
                <p class="MsoNormal">While I’ve done word automation in
                  the past, is it possible that there’s any issues with
                  the word application installation itself?  Or maybe
                  you might have multiple scripts trying to open/write
                  files simultaneously?</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">As well, I might consider looking
                  at task manager on your web server to see if there are
                  a lot of processes for word that might create some
                  sort of bottleneck, or concurrency issue.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">I know when I am doing some
                  selenium work with Google Chrome, sometimes it leaves
                  a rogue Chrome process running, and as a result, the
                  server gets bogged down and can’t do what it’s
                  supposed to very well because of all the chrome
                  processes left over from failed python script
                  instances.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">Typically the error you are seeing
                  might point to a problem with some variable you
                  believe should be an expected value, but in this case,
                  it’s None, or another non-standard value…  Typically,
                  I will log that kind of data from my classic asp web
                  pages to understand the problem more.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">In your case, I might start by
                  writing the file name (self.ruta) to a log file in
                  case it’s blank, or has special characters in it that
                  could be causing issues.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">I hope this helps.  The error
                  messages you are seeing are quite generic, and
                  reference a problem with rendering the webpage and not
                  necessarily a python specific error.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">Steven</p>
                <div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt
                  solid rgb(225,225,225);padding:3pt 0in 0in">
                  <p class="MsoNormal"><b>From:</b> python-win32
                    <python-win32-bounces+steven=<a
                      href="mailto:manross.net@python.org"
                      target="_blank" moz-do-not-send="true"
                      class="moz-txt-link-freetext">manross.net@python.org</a>>
                    <b>On Behalf Of </b>Martín Trujillo Raddatz<br>
                    <b>Sent:</b> Monday, May 29, 2023 12:05 PM<br>
                    <b>To:</b> <a href="mailto:python-win32@python.org"
                      target="_blank" moz-do-not-send="true"
                      class="moz-txt-link-freetext">python-win32@python.org</a><br>
                    <b>Subject:</b> [python-win32] unknow solution</p>
                </div>
                <p class="MsoNormal"> </p>
                <div>
                  <p class="MsoNormal">i ve using the library for some
                    time now without any trouble...... but a few days
                    ago the script for a conversion in word from doc to
                    pdf respond with this error sometimes, other works
                    fine, the error is random, i cant figure out why
                    occurs.</p>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <p class="MsoNormal">the error is:</p>
                  </div>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <p class="MsoNormal"><span
                        style="font-family:"Courier New"">Traceback
                        (most recent call last):<br>
                          File
"C:\inetpub\wwwroot\ruc2docs\venv\lib\site-packages\win32com\client\dynamic.py",
                        line 81, in _GetGoodDispatch<br>
                            IDispatch = pythoncom.connect(IDispatch)<br>
                        pywintypes.com_error: (-2147221021, 'Operación
                        no disponible', None, None)<br>
                        <br>
                        During handling of the above exception, another
                        exception occurred:<br>
                        <br>
                        Traceback (most recent call last):<br>
                          File
                        "C:\inetpub\wwwroot\ruc2docs\r2d2documento.py",
                        line 14, in __init__<br>
                            self.save_as_('pdf')<br>
                          File
                        "C:\inetpub\wwwroot\ruc2docs\r2d2documento.py",
                        line 25, in save_as_<br>
                            word =
                        win32.gencache.EnsureDispatch('Word.Application')<br>
                          File
"C:\inetpub\wwwroot\ruc2docs\venv\lib\site-packages\win32com\client\gencache.py",
                        line 524, in EnsureDispatch<br>
                            disp = win32com.client.Dispatch(prog_id)<br>
                          File
"C:\inetpub\wwwroot\ruc2docs\venv\lib\site-packages\win32com\client\__init__.py",
                        line 95, in Dispatch<br>
                            dispatch, userName =
                        dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)<br>
                          File
"C:\inetpub\wwwroot\ruc2docs\venv\lib\site-packages\win32com\client\dynamic.py",
                        line 98, in _GetGoodDispatchAndUserName<br>
                            return (_GetGoodDispatch(IDispatch, clsctx),
                        userName)<br>
                          File
"C:\inetpub\wwwroot\ruc2docs\venv\lib\site-packages\win32com\client\dynamic.py",
                        line 83, in _GetGoodDispatch<br>
                            IDispatch =
                        pythoncom.CoCreateInstance(IDispatch, None,
                        clsctx, pythoncom.IID_IDispatch)<br>
                        pywintypes.com_error: (-2146959355, 'Error en la
                        ejecución de servidor', None, None)</span></p>
                  </div>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <p class="MsoNormal">the code to execute the
                      conversion is:</p>
                  </div>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <p class="MsoNormal"><span
                        style="font-family:"Courier New"">   
                        def save_as_(self, tipo):<br>
                                import win32com.client as win32<br>
                                from win32com.client import constants<br>
                                # self.registrar_conversion()<br>
                                word =
                        win32.gencache.EnsureDispatch('Word.Application')<br>
                                doc = word.Documents.Open(self.ruta,
                        ReadOnly=True, AddToRecentFiles=False,
                        Revert=True, Visible=False)<br>
                                doc.Activate()<br>
                                if tipo == 'pdf':<br>
                                   
                        word.ActiveDocument.SaveAs(self.ruta[:-4] +
                        '.pdf', FileFormat=constants.wdFormatPDF)<br>
                                elif tipo == 'docx':<br>
                                   
                        word.ActiveDocument.SaveAs(self.ruta[:-4] +
                        '.doc',
                        FileFormat=constants.wdFormatXMLDocument)<br>
                               
                        doc.Close(SaveChanges=constants.wdDoNotSaveChanges)<br>
                                word.Quit()</span></p>
                  </div>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <p class="MsoNormal"><span
                        style="font-family:"Courier New"">Thank
                        you!</span></p>
                  </div>
                  <div>
                    <p class="MsoNormal"> </p>
                  </div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <p class="MsoNormal"><b><span
                                    style="font-size:10pt;font-family:Tahoma,sans-serif">----------------------------------------</span></b></p>
                            </div>
                            <p class="MsoNormal"><b><span
                                  style="font-size:10pt;font-family:Tahoma,sans-serif">Martín
                                  Trujillo Raddatz         <br>
                                  Puerto Montt - Chile            <br>
                                  Teléfono: +56 9 96427814 </span></b></p>
                            <div>
                              <p class="MsoNormal"><b><span
                                    style="font-size:10pt;font-family:Tahoma,sans-serif">----------------------------------------</span></b></p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-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="https://mail.python.org/mailman/listinfo/python-win32">https://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>