473,394 Members | 1,902 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,394 software developers and data experts.

pywin32 com server "cash" question

Hi,

I just got the pywin32 "hello world" COM server to install and I did manage
to use it from VB 6.0.

However, there are some glitches I do not comprehend:

1) at one point I got a python runtime error telling me the "testcomserver"
was not found - I got rid of that problem by deleteting the appropriate (I
hope) registry and reregistering the server

2) If I change the source of the server
from:
return "Hello" + ....
to:
return "Hello my friend " + ....
I still get "Hello BINGO" only in my VB message box. this even if I try to
re-register (which does not seem necessary) the server.
Q.1) What could that error have meant ?
Q.2) is there a way to "flush" whatever so my new code "Hello my friend"
shows up ?


The VB looks like this:

Private Sub Command1_Click()
Dim shdemo = CreateObject("Python.TestServer")
MsgBox (shdemo.Hello("BINGO"))
End Sub

The Python server :

class HelloWorld:

_reg_clsid_ = "{7CC9F362-486D-11D1-BB48-0000E838A65F}"
_reg_desc_ = "Python Test COM Server"
_reg_progid_ = "Python.TestServer"
_public_methods_ = ['Hello']
_public_attrs_ = ['softspace', 'noCalls']
_readonly_attrs_ = ['noCalls']
#_reg_class_spec_ = "testcomserver.HelloWorld"

def __init__(self):

self.softspace = 1

self.noCalls = 0

def Hello(self, who):

self.noCalls = self.noCalls + 1

# insert "softspace" number of spaces

return "Hello My Friend " + " " * self.softspace + str(who)

if __name__=='__main__':
# ni only for 1.4!
import win32com.server.register
win32com.server.register.UseCommandLine(HelloWorld )
import pythoncom
print pythoncom.CreateGuid()

Regards,

Philippe



Jul 21 '05 #1
1 1944
Sorry: "Cache", not "Cash"

Philippe C. Martin wrote:
Hi,

I just got the pywin32 "hello world" COM server to install and I did
manage to use it from VB 6.0.

However, there are some glitches I do not comprehend:

1) at one point I got a python runtime error telling me the
"testcomserver" was not found - I got rid of that problem by deleteting
the appropriate (I hope) registry and reregistering the server

2) If I change the source of the server
from:
return "Hello" + ....
to:
return "Hello my friend " + ....
I still get "Hello BINGO" only in my VB message box. this even if I try to
re-register (which does not seem necessary) the server.
Q.1) What could that error have meant ?
Q.2) is there a way to "flush" whatever so my new code "Hello my friend"
shows up ?


The VB looks like this:

Private Sub Command1_Click()
Dim shdemo = CreateObject("Python.TestServer")
MsgBox (shdemo.Hello("BINGO"))
End Sub

The Python server :

class HelloWorld:

_reg_clsid_ = "{7CC9F362-486D-11D1-BB48-0000E838A65F}"
_reg_desc_ = "Python Test COM Server"
_reg_progid_ = "Python.TestServer"
_public_methods_ = ['Hello']
_public_attrs_ = ['softspace', 'noCalls']
_readonly_attrs_ = ['noCalls']
#_reg_class_spec_ = "testcomserver.HelloWorld"

def __init__(self):

self.softspace = 1

self.noCalls = 0

def Hello(self, who):

self.noCalls = self.noCalls + 1

# insert "softspace" number of spaces

return "Hello My Friend " + " " * self.softspace + str(who)

if __name__=='__main__':
# ni only for 1.4!
import win32com.server.register
win32com.server.register.UseCommandLine(HelloWorld )
import pythoncom
print pythoncom.CreateGuid()

Regards,

Philippe


Jul 21 '05 #2

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

Similar topics

0
by: leo | last post by:
hi there i'm using gene cash's EXIF.py module to find out the shoting time of an jpeg image. this module works usually like a beauty, but some images raise an exception: Traceback (most...
7
by: Murtix Van Basten | last post by:
Hi all, I will deploy a database project to an Oracle server, but I could not figure out which version of Oracle should I get. Here is my configuration: Hardware: Dell 1750 Dual Xeon 3.2Ghz,...
1
by: Michael Bourgon | last post by:
Howdy. I'm trying to build a query that will take an Excel file and pull a few rows of data from a particular sheet. I'm having a problem with my WHERE clause - I can can tell it to import WHERE...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
23
by: Abhi | last post by:
Hi.. I wanted the C source code in machine readable format for the book "Numerical Recipes in C". I got hold of the pdf version of the book somehow. Does anyone have the complete C code of the...
3
by: scott_baird | last post by:
Probably something simple, but it's driving me up the wall... In a report, I have an unbound control that is the total of 2 other bound controls (currency) as follows: unbound control =cash1 +...
15
by: waltbrad | last post by:
Hello. I'm studying the book "C++ Primer Plus" by Stephan Prata. In chapter 6 he gives an exercise that reads from a file. The list is thus: 4 Sam Stone 2000 Freida Flass 100500 Tammy...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.