473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem using win32com

Hi,

A month ago, I decided to move from Delphi to Python/wxPython for a good deal of my development work, and for the past few projects (which included a full re-write of our point-of-sale system) I've had no problems and been very pleased with the move.

We're Sage (accounting software) developers and frequently link into Line 50 using a Sage supplied COM server. In Delphi, the code to create the client and a workspace (which is required later) is as follows:

SDO := CreateOLEObject('SDOEngine.10');
WS := SDO.Workspaces.Add('abc');

So naturally, I'd expect the following Python code to work:

import win32com.client
SDO = win32com.client.Dispatch("SDOEngine.10")
WS = SDO.Workspaces.Add("abc")

But at the last stage, I get an error:

Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
ws=sdo.Workspaces.Add("ss")
File "C:\PYTHON23\lib\site-packages\win32com\client\dynamic.py", line 154, in __call__
return self._get_good_object_(self._oleobj_.Invoke(*allAr gs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147352573, 'Member not found.', None, None)

So I used MakePy to generate the relevant Python interface code, and tried the following:

SDO=win32com.client.gencache.EnsureModule("{ACE2C5 EC-2EC0-4AEB-8B0D-27A5A1ED6421}",0,10,0)
WS=SDO.Workspaces.Add("abc")

But now I get:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: unbound method Add() must be called with IWorkspaces instance as first argument (got str instance instead)

The relevant MakePy generated code looks like this:

class IWorkspaces(DispatchBaseClass):
CLSID = IID('{7075CC61-F056-11D0-A34B-000000000000}')
coclass_clsid = IID('{7075CC63-F056-11D0-A34B-000000000000}')

def Add(self, Name=defaultNamedNotOptArg):
ret = self._oleobj_.InvokeTypes(2, LCID, 1, (9, 0), ((8, 0),),Name)
if ret is not None:
ret = Dispatch(ret, 'Add', None, UnicodeToString=0)
return ret

class Workspaces(CoClassBaseClass): # A CoClass
CLSID = IID('{7075CC63-F056-11D0-A34B-000000000000}')
coclass_sources = [
]
coclass_interfaces = [
IWorkspaces,
]
default_interface = IWorkspaces

What am I doing wrong? And more importantly, what can I do about it? I suspect there's a really simple answer which begins "Chris, you're being a fool...", but it's now pretty late, and I have other matters to deal with for the next few hours, so any help would be much appreciated.

Regards,
Chris

Jul 18 '05 #1
0 1787

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

Similar topics

1
by: Marc | last post by:
Hello, I've fiddled with this for quite a while and thought I had the problem solved. I had a version that would successfully compile and run. But then I had to change the code to use a...
1
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...
1
by: Cristian Hasbun from Chile | last post by:
I need a win32com guru please... i'm not python expert, but i understand mi trouble... Requirements: Hook EyesWeb 3.2.0 (http://www.eyesweb.org) COM Module with Python 2.0.1 i used win32com...
1
by: Cristian Hasbun from Chile | last post by:
I need a win32com guru please... i'm not python expert, but i understand mi trouble... Requirements: Hook EyesWeb 3.2.0 (http://www.eyesweb.org) COM Module with Python 2.0.1 i used win32com...
1
by: Martin Stettner | last post by:
Hi, when trying to generate the wrapper classes for Microsofts ADO Library (Version 2.8) with makepy, I run into the following problem. Here's what I do (I use ActiveState Python 2.4.1.245) ...
2
by: Alexander Eisenhuth | last post by:
Hello together, My system: ActivePython 2.4.1 Windows XP I write a COM Server in VC++ 6.0 using ATL. So far so good. While I develop I got sometimes strange behaviour with makepy utility....
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
1
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()...
2
by: Aleksandar Cikota | last post by:
Hi all, I have a problem with openning of an image. Here is the Code: from Tkinter import * from PIL import Image, ImageTk from win32com.client import gencache import tkMessageBox
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.