exceptions.SystemError: NULL result without error in call_objet
Laurent Boulard
laurent.boulard at bull.net
Tue May 29 06:35:09 EDT 2001
I am an novice with Python (but not with C, C++ and java, windows and
unix platform).
I bought the book "Python: programming on Win32" and try the following
code to learn Python using COM:
-------------------------------------------------------------
# SimpleCOMServer.py - A sample COM server - almost as small as they
come !
#
# We expose a single method in a python COM object
class PythonUtilities:
_public_methods_ = [ 'SplitString' ]
_reg_progid_ = "PythonDemos.Utilities"
# NEVER copy the following ID
# Use "print pythoncom.Createguid()" to make a new one
_reg_clsid_ = "{F900FA22-540A-11D5-8F3F-009027E99CD7}"
def SplitString(self, val, item = None):
import string
print "Splitting " + val + " using " + item
return string.split(val, item)
# Add code so that when this script is run by
# Python.exe, it self-registers.
if __name__=='__main__':
print "Registering COM Server ..."
import win32com.server.register
win32com.server.register.UseCommandLine(PythonUtilities)
-------------------------------------------------------------
and the vb client part:
-------------------------------------------------------------
Sub TestPython()
'
' TestPython Macro
' Macro créée le 29/05/01 par BOULARD
'
Set PythonUtils = CreateObject("PythonDemos.utilities")
response = PythonUtils.SplitString("Hello from VB")
For Each Item In response
MsgBox Item
Next
End Sub
-------------------------------------------------------------
if I register the COM server without debugging, everything works fine.
But if I register it with '--debug' then an error occurs in vb client
on the first line of code:
> Set PythonUtils = CreateObject("PythonDemos.utilities")
---------
Unexpected Python Error:exceptions.SystemError: NULL result without
error in call_object
---------
I'm using Python 2.1-final. Is it a bug in Python ?
Thanks for your help.
More information about the Python-list
mailing list