Ok, I've removed all of the references to my Class nam in the Reg- there were a lot, put in a static GUID, <br>
added self back to the arg list, and now the call to the split function works.<br>
<br>
There seems to be a problem on the VB side now, related to the types.<br>
Mark said all vars in VB need to be objects, and that's another place where I went wrong.<br><br>Will change my variants to Objects.<br><br><br><br><span class="gmail_quote"></span><br><br><div><span class="gmail_quote">
On 12/8/05, <b class="gmail_sendername">Tony C</b> &lt;<a href="mailto:cappy2112@gmail.com">cappy2112@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div><span class="q"><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;&gt;Your main problem is that you forgot the &quot;self&quot; param in the method.
</blockquote></span><div><br>Actually, I started out *with* the self as described in the book.<br>I removed it because the error message implied two args were being passed instead of one, not vice-versa.<br>&nbsp;<br>What do you suggest?
<br>Is there any chance that the previous turds in the reg are causing a problem?<br><br>I will try to remove them all, if I can find them<br><br></div><div><span class="e" id="q_1080b9e05caa3893_3"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Cheers,<br><br>Mark<br>-----Original Message-----<br>From: Tony C [mailto:<a href="mailto:cappy2112@gmail.com" target="_blank" onclick="bluecoat_allow_popup=true;try{
return top.js.OpenExtLink(window,event,this)
}finally{bluecoat_allow_popup=false;}">cappy2112@gmail.com</a>]<br>Sent: Thursday, 8 December 2005 3:25 PM<br>To: Mark Hammond<br>Cc: <a href="mailto:python-win32@python.org" target="_blank" onclick="bluecoat_allow_popup=true;try{
return top.js.OpenExtLink(window,event,this)
}finally{bluecoat_allow_popup=false;}">
python-win32@python.org</a><br>Subject: Re: Python-win32 Digest, Vol 33, Issue 7<br><br><br>Ok, I'm about 90% there now<br><br>I've used the Simple.py from page 213, because there is less involved.<br>when I run it- I see the registration messages. All is good so far.
<br>I made one tiny change, related to the call to CreateGuid()<br><br>import pythoncom<br><br>class PythonCOMServer:<br><br>&nbsp;&nbsp; _public_methods_ = ['pyCOMSplit']<br>&nbsp;&nbsp; _reg_progid_= &quot;PythonCOMDemo&quot;<br>&nbsp;&nbsp; _reg_clsid_= 
pythoncom.CreateGuid()<br><br>&nbsp;&nbsp; def pyCOMSplit(StringFromVB):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from string import split<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if self.StringFromVB != None:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return split(self.StringFromVB )<br><br><br>if __name__ == '__main__':
<br>&nbsp;&nbsp; print&quot;Registering COM server&quot;<br>&nbsp;&nbsp; import win32com.server.register<br>&nbsp;&nbsp; win32com.server.register.UseCommandLine( PythonCOMServer )<br><br><br>When I try sending a string from the VB side,<br>Type Error; str() takes at most 1 arguments, two given
<br><br>I see no explicit calls to str.<br><br><br>Here's the VB side<br><br><br>Option Explicit<br><br>Private Sub cmdToPython_Click()<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Python As Object<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim FromPython&nbsp;&nbsp;As Variant<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Set Python = CreateObject(&quot;PythonCOMDemo&quot;)
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;FromPython = Python.pyCOMSplit(&quot;This string to Python&quot;)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;txtFromPython = FromPython<br><br>End Sub<br><br><br>This call, is what is causing the runtime exception<br>Python.pyCOMSplit (&quot;This string to Python&quot;)
<br><br><br>What am I doing wrong?<br><br>thanks<br><br><br><br><br><br><br><br><br>On 12/6/05, Mark Hammond &lt; <a href="mailto:mhammond@skippinet.com.au" target="_blank" onclick="bluecoat_allow_popup=true;try{
return top.js.OpenExtLink(window,event,this)
}finally{bluecoat_allow_popup=false;}">mhammond@skippinet.com.au</a>&gt; wrote:<br>&gt; &gt;&gt;Certainly COM would work.&nbsp;&nbsp;In this case your VB EXE would use
<br>CreateObject<br>&gt; &gt;&gt;to create a Python implemented object.<br><br>&gt; As what type of Python Object?<br><br>&gt; I have the VB6 ide open, and the references Browser as well,<br>&gt; there is no generic Python object to include into a VB project.
<br><br>&gt; Which means one would have to create a Python COM server<br>&gt; and Type library first, before being able to reference it<br>&gt; from the VB IDE.<br><br>Actually, you don't need to create a typelib.&nbsp;&nbsp;Just register the PythonCOM
<br>server, and have VB use CreateObject with the ProgID.&nbsp;&nbsp;All vars will need to<br>be declared as &quot;object&quot;, and you wont get auto-complete type features, but<br>it will work.&nbsp;&nbsp;VB supports late-binding.<br><br>
<br>
&gt; Even though I have Python Programming in Win32, I'm not sure what<br>&gt; needs to be done to make a minimal Python COM server that can be<br>&gt; called from VB.<br><br>Pages 221 and 222 have an example using VBA (ie, the VB embedded in MSOffice
<br>apps)<br><br>&gt; Also, creating a type library requires using Visual C- which isn't a<br>&gt; problem, it's the language of the IDL required to create the TLB that<br>&gt; I don't udnerstand.<br><br>You should be able to avoid TLBs - certainly to get started...
<br><br>Mark<br><br></blockquote></span></div></div><br>

</blockquote></div><br>