473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

win32com.client .constants - AttributeError

On my machine, this runs fine, but when I try to run it on someone
elses machine it blows up with an attribute error:

<code>
import win32com.client , pythoncom

pythoncom.CoIni tializeEx(pytho ncom.COINIT_APA RTMENTTHREADED)
myWord = win32com.client .dynamic.Dispat ch ("Word.Applicat ion")
myWord.Visible = True
myDoc = myWord.Document s.Open(FileName = "C:\Test.do c")
myDoc .SaveAs(FileNam e = "c:\Test.ht m", FileFormat =
win32com.client .constants.wdFo rmatHTML)

myDoc.Saved=1
myWord.Quit ()

del myWord
pythoncom.CoUni nitialize()
</code>

It's pretty simple code so I don't understand why it doesn't work. I
verified that he has the same pywin32 module as me (build 207) and the
same python version (2.4.2).

Any ideas?

Apr 20 '06 #1
5 21886
The constants are only available if you've run makepy on the
Word object library.

Roger

"kbperry" <ke***********@ gmail.com> wrote in message news:11******** *************@e 56g2000cwe.goog legroups.com...
On my machine, this runs fine, but when I try to run it on someone
elses machine it blows up with an attribute error:

<code>
import win32com.client , pythoncom

pythoncom.CoIni tializeEx(pytho ncom.COINIT_APA RTMENTTHREADED)
myWord = win32com.client .dynamic.Dispat ch ("Word.Applicat ion")
myWord.Visible = True
myDoc = myWord.Document s.Open(FileName = "C:\Test.do c")
myDoc .SaveAs(FileNam e = "c:\Test.ht m", FileFormat =
win32com.client .constants.wdFo rmatHTML)

myDoc.Saved=1
myWord.Quit ()

del myWord
pythoncom.CoUni nitialize()
</code>

It's pretty simple code so I don't understand why it doesn't work. I
verified that he has the same pywin32 module as me (build 207) and the
same python version (2.4.2).

Any ideas?



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Apr 21 '06 #2
how do I do this? Where is the Word object library?

Apr 21 '06 #3
Please help! Anyone else know?

Apr 21 '06 #4
There are a couple of different ways to run makepy.
Start Pythonwin, and from the menu select
Tools->Com Makepy Utility. You should see a list
of registered typelibs. Select "Microsoft Word x.y
Object Library" and hit Ok.
This can also be done programatically by initiating
Word with
win32com.client .gencache.Ensur eDispatch('Word .Application')

Roger

"kbperry" <ke***********@ gmail.com> wrote in message news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
how do I do this? Where is the Word object library?


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Apr 21 '06 #5
Wow..I didn't even realize that this existed. Thanks for your help!

Apr 21 '06 #6

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

Similar topics

0
1761
by: Oliver Emrich | last post by:
p {margin: 0px} Hi all, &nbsp;
1
5180
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly remove old version (as well as the mx libraries I had installed). I then installed the new version as a user with the Administrator role. I know I'm...
0
1896
by: Paul McGuire | last post by:
Software versions: Python - 2.3.3 win32all extensions - build 163 OS- Win2000 SP4 I am having trouble in accessing a customer's proprietary COM type library. After running makepy against the customer's typelib, I am still unable to create a typed object, getting the following Python traceback (I have to sanitize the customer's product, I...
0
4072
by: goermezer | last post by:
Hello, I have some problems to automate a CAD (computer aided design) Software called CATIA V5 from Dassault Systemes. CATIA V5 has a builtin VB-Editor like Word, Excel, … and registers itself as a COM-server. With VB one can automate everything in CATIA V5 with a lot of registered Object Libraries. A VB example:
1
3696
by: koia | last post by:
Hi, I have a problem with adding attributes to a Line in an Excel drawing using the Python win32com interface. From recording in Excel I get the Macro: Sub Makro1() ActiveSheet.Shapes.AddLine(192.75, 63.75, 316.5, 110.25).Select Selection.ShapeRange.Line.ForeColor.SchemeColor = 10 Selection.ShapeRange.Line.Visible = msoTrue
2
2382
by: cfriedalek | last post by:
I'm driving Excel from python, largely successfully. Now I'm trying to add errorbars to XY scatter plots. Keep getting a com_error. Can't track down the problem. I modified a simple example to duplicate the problem. Thanks to Mathieu Fenniak http://www.stompstompstomp.com/weblog/entries/67/ for the code. The traceback is shown below. You...
1
5485
by: Ransom | last post by:
Hey folks... Newbie here. I'm working with win32com launching, closing and re-launching Excel grabbing output and doing stuff. Well, on some occasions, I get the following error: Traceback (most recent call last): File "checkrates.py", line 95, in ?
4
2388
by: rc | last post by:
I'm trying to convert VB code that registers COM+ components to Python. However, I'm unable to set values on COMAdminCatalogObject using the Value() method, it seems to think I'm trying to call the get method. VB Code: Dim cat As COMAdminCatalog Set cat = New COMAdminCatalog Dim apps As COMAdminCatalogCollection Set apps =...
11
7685
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I...
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.