Starting a Python COM server from vb?

  • Thread starter U-CDK_CHARLES\\Charles
  • Start date
U

U-CDK_CHARLES\\Charles

Pretty much what it says.

I've a number of Python services that I'd like to use from vb. The
hitch is ensuring the services are started before the VB program tries
to use them.

Startup folder isn't a good solution, as folks sometimes putter with
their startup folder options.

Is it as simple as exec()-ing the service script? That IS workable,
provided VB's exec() function plays nice and allows the service to run.

I WILL be testing everything I can think of, so there's no especial
urgency here . .yet.

Thanks


charles
 
R

Robert M. Emmons

Pretty much what it says.

I've a number of Python services that I'd like to use from vb. The
hitch is ensuring the services are started before the VB program tries
to use them.

Startup folder isn't a good solution, as folks sometimes putter with
their startup folder options.

Is it as simple as exec()-ing the service script? That IS workable,
provided VB's exec() function plays nice and allows the service to run.

Maybe I missunderstand -- but as far as I know there are NO reasons to
RUN anything before you use it. Only thing you need to do is to
register your Python COM servers.

When you use them in VB, just instantiate them like any other COM
object. Python is not special in any way.

Rob
 
U

U-CDK_CHARLES\\Charles

Maybe I missunderstand -- but as far as I know there are NO reasons to
RUN anything before you use it. Only thing you need to do is to
register your Python COM servers.

When you use them in VB, just instantiate them like any other COM
object. Python is not special in any way.

Rob

How do I ensure that the service is registered? Does this need to
happen after every bootup?

Yes, I AM confused about Win32 services, thank you for noticing :)


Charles
 
R

Robert M. Emmons

How do I ensure that the service is registered? Does this need to
happen after every bootup?

I recommend highly the book: Python Programming on Win32 by Mark
Hammond and Andy Robinson ISBN: 1-56592-621-8. This should anwser many
of your questions regarding Python and windows. They talk both about
COM/ACTIVEX and about windows Servicies.

The short answer to your question--I think it really depends on what you
want. If you really want to run a "Service" in the windows sense, then
yes you probably have to launch this at boot time. Generally Servicies
or Daemons are just programs that run in the background. There is a way
to run these at startup on windows. I can't remember exactly how -- I'm
thinking there is a "Servicies" control panel(???)

On the other hand if your talking about COM/ActiveX Servers that is a
totally different thing. These are not Servicies. There is a standard
way of writing these in Python using the win-32all package -- i.e. the
python windows extnesions. It is to complicated for me to explain
directly here...though it is not difficult. You need the book or
another reference in front of you. Basically to setup a server you have
to add some special attributes to the classes that you want to register,
then some code that does the registration. The registration is
peristant. You put your program in some fixed location and then
register it once and it's good always. I've done this to write nice
little utilities to call from VBA in Excel. Works nice.

The book I referenced by the way covers both COM/ActiveX and Servicies
to regarless of your interest it should have some information.

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top