Python 2.3, win32all-157, AttributeError: wdFormatText

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Reinhard Koenig

    Python 2.3, win32all-157, AttributeError: wdFormatText

    Hello,

    I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
    utility for the Word 8.0 object library. I now receive:

    Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
    on win32
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import win32com.client
    >>> win32com.client .Dispatch("Word .Application")[/color][/color][/color]
    <COMObject Word.Applicatio n>[color=blue][color=green][color=darkred]
    >>> win32com.client .constants.wdFo rmatText[/color][/color][/color]
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "F:\PYTHON\lib\ site-packages\win32c om\client\__ini t__.py", line
    168, in __getattr__
    raise AttributeError, a
    AttributeError: wdFormatText[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]

    I've had no problems with earlier versions.
    What is wrong?
  • Bob Gailer

    #2
    Re: Python 2.3, win32all-157, AttributeError: wdFormatText

    At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
    [color=blue]
    >Hello,
    >
    >I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
    >utility for the Word 8.0 object library. I now receive:
    >
    >Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
    >on win32
    >Type "help", "copyright" , "credits" or "license" for more information.[color=green][color=darkred]
    > >>> import win32com.client
    > >>> win32com.client .Dispatch("Word .Application")[/color][/color]
    ><COMObject Word.Applicatio n>[/color]

    Shouldn't you assign the result of the Dispatch to a variable, then
    reference that variable in subsequent code?[color=blue][color=green][color=darkred]
    >>> app = win32com.client .Dispatch("Word .Application")[/color][/color][/color]
    [snip]

    Bob Gailer
    bgailer@alum.rp i.edu
    303 442 2625


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003

    Comment

    • Reinhard Koenig

      #3
      Re: Python 2.3, win32all-157, AttributeError: wdFormatText

      Hello Bob,

      you are certainly right that I have to assign the result of the Dispatch to a
      variable but in this case I used this statement for demonstration purposes only.
      I 've found the error now. The makepy utility generated a wrong file name for
      the Microsoft Word Object library.
      The last part of '00020905-0000-0000-C000-000000000046x40 9x8x0.py' (409x8x0) was
      something different, therefore Python didn't found this file and the name
      'win32com.clien t.constants.wdF ormatText' couldn't be resolved.
      Now, with win32all-163 and ActivePython 2.3.2-232 all works well.

      Reinhard Koenig


      Bob Gailer wrote:[color=blue]
      >
      > At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
      >[color=green]
      > >Hello,
      > >
      > >I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
      > >utility for the Word 8.0 object library. I now receive:
      > >
      > >Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
      > >on win32
      > >Type "help", "copyright" , "credits" or "license" for more information.[color=darkred]
      > > >>> import win32com.client
      > > >>> win32com.client .Dispatch("Word .Application")[/color]
      > ><COMObject Word.Applicatio n>[/color]
      >
      > Shouldn't you assign the result of the Dispatch to a variable, then
      > reference that variable in subsequent code?[color=green][color=darkred]
      > >>> app = win32com.client .Dispatch("Word .Application")[/color][/color]
      > [snip]
      >
      > Bob Gailer
      > bgailer@alum.rp i.edu
      > 303 442 2625
      >
      > --------------------------------------------------------------------------------
      >
      > ---
      > Outgoing mail is certified Virus Free.
      > Checked by AVG anti-virus system (http://www.grisoft.com).
      > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003[/color]

      Comment

      • Reinhard Koenig

        #4
        Re: Python 2.3, win32all-157, AttributeError: wdFormatText

        Hello,

        I needed the display statement for demonstration purposes only. You are right,
        that ordinarily I have to assign the result to a variable.
        The solution is that the makepy utility generated a wrong file name for the
        Microsoft Word object library resp. Python looked for a wrong name.
        The part after 'x' (00020905-0000-0000-C000-000000000046x40 9x8x0.py) was wrong.
        Now all works fine with win32all-163 resp. ActivePython2.3 .2-132.

        Reinhard Koenig


        Bob Gailer wrote:[color=blue]
        >
        > At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
        >[color=green]
        > >Hello,
        > >
        > >I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
        > >utility for the Word 8.0 object library. I now receive:
        > >
        > >Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
        > >on win32
        > >Type "help", "copyright" , "credits" or "license" for more information.[color=darkred]
        > > >>> import win32com.client
        > > >>> win32com.client .Dispatch("Word .Application")[/color]
        > ><COMObject Word.Applicatio n>[/color]
        >
        > Shouldn't you assign the result of the Dispatch to a variable, then
        > reference that variable in subsequent code?[color=green][color=darkred]
        > >>> app = win32com.client .Dispatch("Word .Application")[/color][/color]
        > [snip]
        >
        > Bob Gailer
        > bgailer@alum.rp i.edu
        > 303 442 2625
        >
        > --------------------------------------------------------------------------------
        >
        > ---
        > Outgoing mail is certified Virus Free.
        > Checked by AVG anti-virus system (http://www.grisoft.com).
        > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003[/color]

        Comment

        • Reinhard Koenig

          #5
          Re: Python 2.3, win32all-157, AttributeError: wdFormatText

          Hello,

          I needed the display statement for demonstration purposes only. You are right,
          that ordinarily I have to assign the result to a variable.
          The solution is that the makepy utility generated a wrong file name for the
          Microsoft Word object library resp. Python looked for a wrong name.
          The part after 'x' (00020905-0000-0000-C000-000000000046x40 9x8x0.py) was wrong.
          Now all works fine with win32all-163 resp. ActivePython2.3 .2-132.

          Reinhard Koenig


          Reinhard Koenig wrote:[color=blue]
          >
          > Hello,
          >
          > I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
          > utility for the Word 8.0 object library. I now receive:
          >
          > Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
          > on win32
          > Type "help", "copyright" , "credits" or "license" for more information.[color=green][color=darkred]
          > >>> import win32com.client
          > >>> win32com.client .Dispatch("Word .Application")[/color][/color]
          > <COMObject Word.Applicatio n>[color=green][color=darkred]
          > >>> win32com.client .constants.wdFo rmatText[/color][/color]
          > Traceback (most recent call last):
          > File "<stdin>", line 1, in ?
          > File "F:\PYTHON\lib\ site-packages\win32c om\client\__ini t__.py", line
          > 168, in __getattr__
          > raise AttributeError, a
          > AttributeError: wdFormatText[color=green][color=darkred]
          > >>>[/color][/color]
          >
          > I've had no problems with earlier versions.
          > What is wrong?[/color]

          Comment

          • Reinhard Koenig

            #6
            Re: Python 2.3, win32all-157, AttributeError: wdFormatText

            Hello,

            I needed the display statement for demonstration purposes only. You are right,
            that ordinarily I have to assign the result to a variable.
            The solution is that the makepy utility generated a wrong file name for the
            Microsoft Word object library resp. Python looked for a wrong name.
            The part after 'x' (00020905-0000-0000-C000-000000000046x40 9x8x0.py) was wrong.
            Now all works fine with win32all-163 resp. ActivePython2.3 .2-132.

            Reinhard Koenig


            Bob Gailer wrote:[color=blue]
            >
            > At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
            >[color=green]
            > >Hello,
            > >
            > >I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy
            > >utility for the Word 8.0 object library. I now receive:
            > >
            > >Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
            > >on win32
            > >Type "help", "copyright" , "credits" or "license" for more information.[color=darkred]
            > > >>> import win32com.client
            > > >>> win32com.client .Dispatch("Word .Application")[/color]
            > ><COMObject Word.Applicatio n>[/color]
            >
            > Shouldn't you assign the result of the Dispatch to a variable, then
            > reference that variable in subsequent code?[color=green][color=darkred]
            > >>> app = win32com.client .Dispatch("Word .Application")[/color][/color]
            > [snip]
            >
            > Bob Gailer
            > bgailer@alum.rp i.edu
            > 303 442 2625
            >
            > --------------------------------------------------------------------------------
            >
            > ---
            > Outgoing mail is certified Virus Free.
            > Checked by AVG anti-virus system (http://www.grisoft.com).
            > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003[/color]

            Comment

            Working...