By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,353 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,353 IT Pros & Developers. It's quick & easy.

win32com: error 80004005

P: n/a
ago
I am trying to make the win32com HelloWorld server work with a VBA
client but I get:

Run-time error '-2147467259(80004005)':
Automation error
Unspecified error

I googled for the error but the suggested solutions (commenting out
_reg_class_spec_ and putting the server on the python path) do not seem
to make any difference (to be precise, unless I comment out
_reg_class_spec_ I cannot register the server at all) . The server
works under the python client but not on excel vba. I also tried to
debug with win32traceutil.py but I can only see the trace when using
the python client, not with excel. Any hint would be appreciated.

### PYTHON SERVER ###
class HelloClass:
_reg_desc_ = "Python Test COM Server"
_reg_clsid_ = "{91281AFC-25DF-4400-8868-FDBFCA2612A2}"
_reg_progid_ = "Python.HelloHello"
_public_methods_ = ['Hello']

def __init__(self): pass
def Hello(self): return "Hello"

if __name__ == "__main__":
import win32com.server.register
import sys
#sys.argv.append("--debug")
win32com.server.register.UseCommandLine(HelloClass )

### PYTHON CLIENT (WORKS) ###
import win32com.client
obj = win32com.client.Dispatch('Python.HelloHello')
print obj.Hello()

### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObject") ###
Public Sub test()
Dim obj As Object
Set obj = CreateObject("Python.HelloHello")
MsgBox obj.Hello("ago")
End Sub

Mar 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ago
I solved it. If someone else is in the same situation...

It was due to a defective installation. I reinstalled python and pywin,
re-registered the server and everything worked well.

Mar 28 '06 #2

P: n/a
The only thing I see wrong is that the Hello method
doesn't take any arguments, but the VB code is passing one.
It works fine for me if I remove the arg.
When registered with --debug, you should still be able
to see the output in Pythonwin's trace collector window
even when the object is instantiated via VB.

hth
Roger

"ago" <xi*****@gmail.com> wrote in message news:11*********************@j33g2000cwa.googlegro ups.com...
I am trying to make the win32com HelloWorld server work with a VBA
client but I get:

Run-time error '-2147467259(80004005)':
Automation error
Unspecified error

I googled for the error but the suggested solutions (commenting out
_reg_class_spec_ and putting the server on the python path) do not seem
to make any difference (to be precise, unless I comment out
_reg_class_spec_ I cannot register the server at all) . The server
works under the python client but not on excel vba. I also tried to
debug with win32traceutil.py but I can only see the trace when using
the python client, not with excel. Any hint would be appreciated.

### PYTHON SERVER ###
class HelloClass:
_reg_desc_ = "Python Test COM Server"
_reg_clsid_ = "{91281AFC-25DF-4400-8868-FDBFCA2612A2}"
_reg_progid_ = "Python.HelloHello"
_public_methods_ = ['Hello']

def __init__(self): pass
def Hello(self): return "Hello"

if __name__ == "__main__":
import win32com.server.register
import sys
#sys.argv.append("--debug")
win32com.server.register.UseCommandLine(HelloClass )

### PYTHON CLIENT (WORKS) ###
import win32com.client
obj = win32com.client.Dispatch('Python.HelloHello')
print obj.Hello()

### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObject") ###
Public Sub test()
Dim obj As Object
Set obj = CreateObject("Python.HelloHello")
MsgBox obj.Hello("ago")
End Sub



----== 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 =---
Mar 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.