473,503 Members | 11,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python COM vs Visual Basic COM


I have to use an ultra simple call to a couple of
WordPerfect COM functions.

This works in Visual Basic as follows:

Dim objWP As Variant
Dim DocSumString As Variant
Set objWP = CreateObject("WordPerfect.PerfectScript")
objWP.FileOpen "c:\zebra.wpd", 1
DocSumString = objWP.DocSumGet(18)
Me!Text1 = DocSumString

This opens a WordPerfect file and grabs the 'Descriptive
Type' field from the document summary as a string. Pretty
simple.

Here is almost Identical Python Code:

import win32com.client
objWP =
win32com.client.Dispatch("WordPerfect.PerfectScrip t")
objWP.FileOpen("c:\\zebra.wpd", 1)
DocSumString = objWP.DocSumGet(18)
When I run it it gives me the following error:

Traceback (most recent call last):
File "C:/python_code/getdescriptivetype.py", line 3, in
-toplevel-
objWP.FileOpen("c:\\zebra.wpd", 1)
File
"C:\PYTHON23\Lib\site-packages\win32com\client\dynamic.py",
line 484, in __getattr__
raise pythoncom.com_error, details
com_error: (-2147352567, 'Exception occurred.', (61704,
'WPWIN10', 'Internal application error.', None, 0, 0), None)

I am unable to decipher what this means and am at a loss for
what to try next.

I can write my application in Visual Basic if I have to, but
I would much rather use Python.

Any assistance will be greatly appreciated.

Thanks,

-Kendall
Jul 18 '05 #1
3 2146
On 03 Sep 2004 12:31:04 EDT, Kendall Dugger <kw*@lawcomputing.com>
declaimed the following in comp.lang.python:

objWP.FileOpen("c:\\zebra.wpd", 1)
Wild guess... Try without doubling the \, or use a single /
instead.

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #2
Nope, I have tried r"c:\zebra.wpd" and also used the sys.os
module to test if the file "c:\\zebra.wpd" exists prior to
running the COM stuff.

Python recognizes that the file is there. It seems to be an
error with the COM calls themselves.

Thanks for the suggestion, but I'm still stumped.

It's really frustrating that it works flawlessly under VB,
but fails under Python with almost identical code.

-Kendall

Dennis Lee Bieber wrote:

On 03 Sep 2004 12:31:04 EDT, Kendall Dugger <kw*@lawcomputing.com>
declaimed the following in comp.lang.python:
objWP.FileOpen("c:\\zebra.wpd", 1)


Wild guess... Try without doubling the \, or use a single /
instead.

--
> ================================================== ============ <
> wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wu******@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #3
"Kendall Dugger" <kw*@lawcomputing.com> wrote in message
news:41***************@lawcomputing.com...

I have to use an ultra simple call to a couple of
WordPerfect COM functions.

<snip>

Try reposting on the win32 list at ActiveState. I think you will get a
quicker response.

-- Paul
Jul 18 '05 #4

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

Similar topics

13
35482
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
65
6663
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
8
2279
by: Will | last post by:
I just discovered Python and looked briefly at one of the tutorials for beginners... It looks a lot like the old Command line Basic... I'm sure it does much more but... 1 - Can you create...
14
4503
by: BOOGIEMAN | last post by:
Well that's it, how do I make Windows Application with Python ??? Is there simple way that works 100% ? How can I rework visual design done in VS 2003 to use it for my python program ?
32
8049
by: Mike Cox | last post by:
As you may or may not know, Microsoft is discontinuing Visual Basic in favor of VB.NET and that means I need to find a new easy programming language. I heard that Python is an interpreted language...
12
12251
by: Rex Eastbourne | last post by:
Hi, I'm interested in running a Python interpreter in Emacs. I have Python extensions for Emacs, and my python menu lists "C-c !" as the command to run the interpreter. Yet when I run it I get...
35
2336
by: John Coleman | last post by:
Greetings, I have a rough classification of languages into 2 classes: Zen languages and tool languages. A tool language is a language that is, well, a *tool* for programming a computer. C is the...
23
2359
by: gord | last post by:
As a complete novice in the study of Python, I am asking myself where this language is superior or better suited than others. For example, all I see in the tutorials are lots of examples of list...
122
7209
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
0
7194
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
7070
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
7316
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
6976
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
7449
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...
1
4993
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
4666
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
3160
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...
0
372
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...

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.