473,657 Members | 2,659 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("W ordPerfect.Perf ectScript")
objWP.FileOpen "c:\zebra.w pd", 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("Word Perfect.Perfect Script")
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/getdescriptivet ype.py", line 3, in
-toplevel-
objWP.FileOpen( "c:\\zebra.wpd" , 1)
File
"C:\PYTHON23\Li b\site-packages\win32c om\client\dynam ic.py",
line 484, in __getattr__
raise pythoncom.com_e rror, 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 2157
On 03 Sep 2004 12:31:04 EDT, Kendall Dugger <kw*@lawcomputi ng.com>
declaimed the following in comp.lang.pytho n:

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

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

Jul 18 '05 #2
Nope, I have tried r"c:\zebra.w pd" 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*@lawcomputi ng.com>
declaimed the following in comp.lang.pytho n:
objWP.FileOpen( "c:\\zebra.wpd" , 1)


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

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

Jul 18 '05 #3
"Kendall Dugger" <kw*@lawcomputi ng.com> wrote in message
news:41******** *******@lawcomp uting.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
35524
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
65
6725
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 language's 30+ year evolution. What to you think python largest compromises are? The three that come to my mind are significant whitespace, dynamic typing, and that it is interpreted - not compiled. These three put python under fire and cause...
8
2286
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 windows, buttons, user input fields, etc as you can with Visual Basic? 2 - Can you call Windows Procedures or what ever they call them
14
4516
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
8082
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 similar to VB. This means that it doesn't have all the hard stuff like pointers, classes and templates like C, C++ and assembly language. Where I work we use Microsoft Office with a lot of customization using Visual Basic. I would like to...
12
12277
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 the message "Spawning Child Process: invalid argument." What do I need to do/download to fix this? I read in a post in this group from a while back where someone had the following lines in his .emacs file:
35
2366
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 prototypical tool language. Most languages in the Algol family are tool languages. Visual Basic and Java are also tool languages. On the other hand, a Zen language is a language which is purported to transform your way of thinking about...
23
2387
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 processing, arithmetic calculations - all in a DOS-like environment. What is particularly disappointing is the absence of a Windows IDE, components and an event driven paradigm. How does Python stand relative to the big 3, namely Visual C++,...
122
7332
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 outside of that class. This structured way allows visual tools to host components, and allows programmers to build applications and libraries visually in a RAD environment. The Java language has JavaBeans as its component model which allows Java...
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7316
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.