473,698 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

service windows avec py2exe

Bonjour à tous,

apres avoir créer un service windows avec py2exe,
j'ai ce probleme quand je lance le service :

voici ce que je trouve dans le journal d'evenement :

The instance's SvcRun() method failed
<Error getting traceback - traceback.print _tb() failed
<class 'pywintypes.com _error'>: (-2147221020, 'Syntaxe incorrecte',
None, None)

je n'arrive pas du tout à trouver le probleme.

Peut etre que quelqu'un d'entre vous sais...

Merci

Nov 10 '06 #1
5 2609
Sorry for language, i wanted post in FR.comp.lang.py thon.

But...

hello with all, after having to create a Windows service with py2exe, I
have this problem when I launch the service: here what I find in the
eventLog:

The instance's SvcRun() method failed
<Error getting traceback - traceback.print _tb() failed
<class 'pywintypes.com _error'>: (-2147221020, 'Syntaxe incorrecte',
None, None)

I don't find a the problem.

If you can help me, thank's

Nov 10 '06 #2
At Friday 10/11/2006 08:15, DarkPearl wrote:
>apres avoir créer un service windows avec py2exe,
j'ai ce probleme quand je lance le service :

voici ce que je trouve dans le journal d'evenement :

The instance's SvcRun() method failed
<Error getting traceback - traceback.print _tb() failed
<class 'pywintypes.com _error'>: (-2147221020, 'Syntaxe incorrecte',
None, None)
Try with a small sample application then adding
more functions, to see where it fails.
(Pardonnez moi, je ne sais pas assez pour répondre en française)
--
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Nov 10 '06 #3
I found the function which starts the error

*************** *************** ****
class Win32ProcessUsa ge:
def __init__(self):
self.lstProcess =[]
self.WMIService =
win32com.client .GetObject(r"wi nmgmts:{imperso nationLevel=imp ersonate}!\\.\r oot\cimv2")
self.reset()
def reset(self):
self.lstProcess =[]
lstTmp = self.WMIService .ExecQuery('Sel ect * from
Win32_Process')
for item in lstTmp:

self.lstProcess .append(tuple([item.Name,item. CommandLine,ite m.Status,item.P rocessId,item.P arentProcessId]))

def get_usage(self) :
return self.lstProcess
*************** *************** ****

it is a class which allows to obtain the list of the processes who run.

With python interpreter, this class functions very well but , when it
turns in service, it starts the error :

The instance's SvcRun() method failed
<Error getting traceback - traceback.print _tb() failed
<class 'pywintypes.com _error'>: (-2147221020, 'Syntaxe incorrecte',
None, None)

Why ???

Nov 11 '06 #4
ok,

It's this line who crash the service :

self.WMIService
=win32com.clien t.GetObject(r"w inmgmts:{impers onationLevel=im personate}!\\.\ root\cimv2")
why this function goes when it is not a service?

with IDLE -ok
with py2exe executable (no windows service) -ok
with py2exe service option true (windows service) -CRASH....

Nov 12 '06 #5

DarkPearl wrote:
ok,

It's this line who crash the service :

self.WMIService
=win32com.clien t.GetObject(r"w inmgmts:{impers onationLevel=im personate}!\\.\ root\cimv2")
why this function goes when it is not a service?

with IDLE -ok
with py2exe executable (no windows service) -ok
with py2exe service option true (windows service) -CRASH....
OK. I think I can help here. WMI is a COM/DCOM-based technology.
Windows services are inherently multithreaded. Therefore you need to
Initialize a COM threading model specifically even though you're not
really using threads yourself.

Try putting:

import pythoncom
pythoncom.CoIni tialize ()

somewhere before the line which instantiates the WMI
object (the one you quoted above).

I have no idea why this usually manifests itself as a
"Syntax Error" but it does!

TJG

Nov 12 '06 #6

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

Similar topics

1
1397
by: ThunderMusic | last post by:
Hi, I'm currently stuck with a big problem. I must develop a Windows service and an application to configure it and display what is happening. The problem is not really on the service side, but on the application side. I explain: The service is composed of a kernel dynamicaly loading plug-ins modules and starts the process of each module. Until nous, it's not that hard. The hard part is when it comes to the application to configure...
0
309
by: tt | last post by:
My mod_python 3.1.4 installation works when Apache 2.0.54 is run in standalone mode (apache -k standalone) but refuses to operate when run as a service (apache -k restart). Logs yield the usual and well-known "make_obcallback: could not import mod_python.apache" error. I have tried PYTHONHOME, LoadFile python24.dll (2.4.2) with no result. I have read *all* threads about make_obcallback that google found. What's even weirder I had this...
1
6410
by: Murali | last post by:
Hi All, How to control(Start / Stop) a "Windows Service" (written in C#) from a windows application(.exe). Please send any URL/Solution which will guide me to solve this issue. Thanks in Advance. Murali
4
9020
by: Kris | last post by:
I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service still shows on a Task Manager list. In Services it says it is still running. However there is no way to stop it other than by rebooting the whole computer. No exception (including non-CLS) is ever generated. I added a separate System.Timers.Timer...
1
2704
by: Laurent | last post by:
Kikoo, Je cherche un exemple de code de service windows qui utilise un Certificat X509, sans avoir besoin de se logger dans windows. Je me galère avec l'API Crypt32. Merci.
7
3040
by: Ollie Riches | last post by:
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEncoderLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message: "File or assembly name Interop.WMEncoderLib, or one of its dependencies, was not...
3
3807
by: Thomas Miller | last post by:
Is there ANY way for a windows app to consume a web service by going through a SOCKS proxy? This is a MUST for me because the windows app I am building will be deployed to many corporate clients who are behind SOCKS proxies. My app also has corporate clients that are behind a HTTP proxy. Is there a way for the windows app to consume a web service through a HTTP proxy? Please post any relevant code you have, THANKS!
0
2250
by: guilligan.geo | last post by:
Hello, I'm trying to create an addin for Outlook 2002 using the one provided in the demo of win32com as a starting point. I've been able to do my addin and test it if I go the "standard" way (using the python interpreter). But now, I want other poeple to use it to I want to freeze it for windows using py2exe and py2exe is giving me a headache. First, I cannot seem to be able to register my addin with the resulting executable. I've...
0
2009
by: Griff | last post by:
Overview When the first call to our Web Service causes an exception, the Web Service caches that user's credentials for its life time. Details We have a Web Service which uses Windows Authentication. Within the Web Service we look at the current username and check which user Groups it belongs to.
0
8673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.