473,465 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.
import win32com.client
win32com.client.Dispatch("Word.Application") <COMObject Word.Application> win32com.client.constants.wdFormatText Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "F:\PYTHON\lib\site-packages\win32com\client\__init__.py", line
168, in __getattr__
raise AttributeError, a
AttributeError: wdFormatText


I've had no problems with earlier versions.
What is wrong?
Jul 18 '05 #1
5 2527
At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
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.
import win32com.client
win32com.client.Dispatch("Word.Application")<COMObject Word.Application>


Shouldn't you assign the result of the Dispatch to a variable, then
reference that variable in subsequent code?
app = win32com.client.Dispatch("Word.Application")

[snip]

Bob Gailer
bg*****@alum.rpi.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

Jul 18 '05 #2
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-000000000046x409x8x0.py' (409x8x0) was
something different, therefore Python didn't found this file and the name
'win32com.client.constants.wdFormatText' couldn't be resolved.
Now, with win32all-163 and ActivePython 2.3.2-232 all works well.

Reinhard Koenig
Bob Gailer wrote:

At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
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.
>> import win32com.client
>> win32com.client.Dispatch("Word.Application")

<COMObject Word.Application>


Shouldn't you assign the result of the Dispatch to a variable, then
reference that variable in subsequent code?
>>> app = win32com.client.Dispatch("Word.Application")

[snip]

Bob Gailer
bg*****@alum.rpi.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

Jul 18 '05 #3
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-000000000046x409x8x0.py) was wrong.
Now all works fine with win32all-163 resp. ActivePython2.3.2-132.

Reinhard Koenig
Bob Gailer wrote:

At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
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.
>> import win32com.client
>> win32com.client.Dispatch("Word.Application")

<COMObject Word.Application>


Shouldn't you assign the result of the Dispatch to a variable, then
reference that variable in subsequent code?
>>> app = win32com.client.Dispatch("Word.Application")

[snip]

Bob Gailer
bg*****@alum.rpi.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

Jul 18 '05 #4
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-000000000046x409x8x0.py) was wrong.
Now all works fine with win32all-163 resp. ActivePython2.3.2-132.

Reinhard Koenig
Reinhard Koenig wrote:

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.
import win32com.client
win32com.client.Dispatch("Word.Application") <COMObject Word.Application> win32com.client.constants.wdFormatText Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "F:\PYTHON\lib\site-packages\win32com\client\__init__.py", line
168, in __getattr__
raise AttributeError, a
AttributeError: wdFormatText


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

Jul 18 '05 #5
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-000000000046x409x8x0.py) was wrong.
Now all works fine with win32all-163 resp. ActivePython2.3.2-132.

Reinhard Koenig
Bob Gailer wrote:

At 01:18 AM 10/20/2003, Reinhard Koenig wrote:
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.
>> import win32com.client
>> win32com.client.Dispatch("Word.Application")

<COMObject Word.Application>


Shouldn't you assign the result of the Dispatch to a variable, then
reference that variable in subsequent code?
>>> app = win32com.client.Dispatch("Word.Application")

[snip]

Bob Gailer
bg*****@alum.rpi.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

Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Miguel Hernández Martos | last post by:
Hello, I have seen an old post (http://dbforums.com/t552213.html) refering to the support for dde hot links in win32all. With dde module I can build a DDE server that notifies clients (VB and...
0
by: Tom Semple | last post by:
Apparently the current version of win32all does not work on win95 (please correct me if I am wrong). Python2.3.2 itself works fine. Does anyone happen to know the win32all version that last...
2
by: Jeff Wagner | last post by:
I just tried to install Python Win32 (win32all-163.exe) and right after the install, I am getting the message: "As this is being installed as a non-admin user, certain COM features will not work...
20
by: BJ MacNevin | last post by:
Hi all, I teach middle school and am currently trying to bring some computer science to the students. Our district has a wonderfully linked network throughout all our schools... done via MS...
0
by: Emile van Sebille | last post by:
QOTW (in the OS agnostic category): "There is a (very popular) Python package out there which exposes the win32 api. I'm not sure what it's called. (win32api? pythonwin? win32all?)" -- Francis...
3
by: Gerry Blais | last post by:
Newbie questions: Suppose abc.xls has sheets a, b, c. How can I find, in Python, the sheet names? Given a sheet name, how can I export the sheet as a csv file? Finally, how can I, in...
9
by: arvind | last post by:
Hi all, I am going to work on Python 2.4.3 and MSSQL database server on Windows platform. But I don't know how to make the connectivity or rather which module to import. I searched for the...
4
by: Jack | last post by:
I searched around but could not find win32all source or binaries for earlier versions of Python. Don't ask me why but I have to use Python 1.5.2 in this project :) The sourceforget page only has...
8
by: kyosohma | last post by:
Hi, I've been googling all over and can't find any good answers about this problem. I would like to create some kind of MAPI interface with Python such that when I open Microsoft Word (or...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.