473,406 Members | 2,713 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,406 software developers and data experts.

_ssl.pyd is buggy?


Hello,

I wrote a small program that uses xmlrpc over https. It should work as a
win32 application and as a win32 service too. There is a file called
Processor.py that contains the main thread of the program. It is called
from two files: win32_Application.py and win32_Service.py. The
application works perfectly. The service does not. I can start it from
the services mmc console, but it does not created logfiles, and does
nothing. It cannot be stopped and I have to kill pythonservice.exe. The
event log shows this:
Information: The AmazonOfferDownloaderService service has started.
Application error: Faulty application: python.exe, version: 0.0.0.0,
faulty modul: _ssl.pyd, version: 0.0.0.0, memory address: 0x00019b87.

Is it possible that my _ssl.pyd is faulty? Please help me.

Python version: 2.4.3 (#69, Mar 29 2006)
Windows version: Windows XP Professional, service pack 2, Hungarian (I
translated the above messages from the event log....)

Thanks,

Laszlo

>>Here is the code for the application:
import thread,threading,time

from Processor import *
from servicelog import *
from win32_Config import *

stopped = threading.Event()
stopped.clear()
processor = Processor(stopped)
thread.start_new_thread(processor.Process,())
logger = getLogger('win32_Application')
logger.info("Staring as application. Please press CTRL+C to stop service.")
while 1:
try:
time.sleep(1)
except:
break
logger.info("Stopping application " + SERVICE_NAME)
stopped.set()
while not processor.stopped.isSet():
logger.debug("Waiting for the processor to finish...")
time.sleep(1)

logger.info("Application stopped.")
>>Here is the code for the service:
from win32_Config import *
from Processor import *
from servicelog import *

import win32serviceutil, win32service
import pywintypes, win32con, winerror
from win32event import *
from win32file import *
from win32pipe import *
from win32api import *
from ntsecuritycon import *

import traceback
import thread,threading

class Service(win32serviceutil.ServiceFramework):
_svc_name_ = SERVICE_NAME
_svc_display_name_ = SERVICE_DISPLAY
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.stopped = threading.Event()
self.stopped.clear()
self.logger = getLogger(SERVICE_NAME)

def SvcStop(self):
self.logger.info("Got SvcStop, trying to stop service...")
self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING)
self.stopped.set()

def SvcDoRun(self):
"""Write an event log record - in debug mode we will also see
this message printed."""
try:
import servicemanager
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)
self.logger.info("Started.")
self.logger.debug("Creating processor instance")
processor = Processor(self.stopped)
self.logger.debug("Starting processor thread")
thread.start_new_thread(processor.Process,())
self.logger.debug("Waiting for the processor thread to finish")
self.stopped.wait()
self.logger.debug("Stopping")
time.sleep(1)
while not processor.stopped.isSet():

self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING, 5000)
time.sleep(5)
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, "")
)
self.logger.info("Stopped")
except:
self.logger.error('',exc_info = sys.exc_info())
if __name__=='__main__':
win32serviceutil.HandleCommandLine(Service)
Feb 13 '07 #1
8 2332
Laszlo Nagy wrote:
>
Hello,

I wrote a small program that uses xmlrpc over https. It should work as a
win32 application and as a win32 service too. There is a file called
Processor.py that contains the main thread of the program. It is called
from two files: win32_Application.py and win32_Service.py. The
application works perfectly. The service does not. I can start it from
the services mmc console, but it does not created logfiles, and does
nothing. It cannot be stopped and I have to kill pythonservice.exe. The
event log shows this:
Information: The AmazonOfferDownloaderService service has started.
Application error: Faulty application: python.exe, version: 0.0.0.0,
faulty modul: _ssl.pyd, version: 0.0.0.0, memory address: 0x00019b87.

Is it possible that my _ssl.pyd is faulty? Please help me.

Python version: 2.4.3 (#69, Mar 29 2006)
Windows version: Windows XP Professional, service pack 2, Hungarian (I
translated the above messages from the event log....)

Thanks,

Laszlo

>>>Here is the code for the application:

import thread,threading,time

from Processor import *
from servicelog import *
from win32_Config import *

stopped = threading.Event()
stopped.clear()
processor = Processor(stopped)
thread.start_new_thread(processor.Process,())
logger = getLogger('win32_Application')
logger.info("Staring as application. Please press CTRL+C to stop service.")
while 1:
try:
time.sleep(1)
except:
break
logger.info("Stopping application " + SERVICE_NAME)
stopped.set()
while not processor.stopped.isSet():
logger.debug("Waiting for the processor to finish...")
time.sleep(1)

logger.info("Application stopped.")
>>>Here is the code for the service:

from win32_Config import *
from Processor import *
from servicelog import *

import win32serviceutil, win32service
import pywintypes, win32con, winerror
from win32event import *
from win32file import *
from win32pipe import *
from win32api import *
from ntsecuritycon import *

import traceback
import thread,threading

class Service(win32serviceutil.ServiceFramework):
_svc_name_ = SERVICE_NAME
_svc_display_name_ = SERVICE_DISPLAY
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.stopped = threading.Event()
self.stopped.clear()
self.logger = getLogger(SERVICE_NAME)

def SvcStop(self):
self.logger.info("Got SvcStop, trying to stop service...")
self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING)
self.stopped.set()

def SvcDoRun(self):
"""Write an event log record - in debug mode we will also see
this message printed."""
try:
import servicemanager
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)
self.logger.info("Started.")
self.logger.debug("Creating processor instance")
processor = Processor(self.stopped)
self.logger.debug("Starting processor thread")
thread.start_new_thread(processor.Process,())
self.logger.debug("Waiting for the processor thread to finish")
self.stopped.wait()
self.logger.debug("Stopping")
time.sleep(1)
while not processor.stopped.isSet():

self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING, 5000)
time.sleep(5)
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, "")
)
self.logger.info("Stopped")
except:
self.logger.error('',exc_info = sys.exc_info())
if __name__=='__main__':
win32serviceutil.HandleCommandLine(Service)

I was using _ssl.pyd to upload files to DAV server over ssl and
found it to be a problem. I upgraded to Python 2.5 and the problem
was fixed. I don't know if it is the same problem that is affecting
you, but I couldn't get it to work on 2.4.

FYI, Larry
Feb 13 '07 #2
I was using _ssl.pyd to upload files to DAV server over ssl and
found it to be a problem. I upgraded to Python 2.5 and the problem
was fixed. I don't know if it is the same problem that is affecting
you, but I couldn't get it to work on 2.4.

FYI, Larry
I just installed Python 2.5 and now I do not get the error message in
the event log. But the service still cannot be stopped and does not log
anything. I'm using the logging module and RotatingFileHandler, so the
service should start logging into a new file immediately after startup.
According to the event log, the service is started, but it does nothing.
If I start the same program as an application, it works fine. The
program only uses the standard lib. Any ideas, what can be the problem?

Thanks,

Laszlo
Feb 13 '07 #3
En Tue, 13 Feb 2007 14:40:20 -0300, Laszlo Nagy
<ga*****@designaproduct.bizescribió:
I just installed Python 2.5 and now I do not get the error message in
the event log. But the service still cannot be stopped and does not log
anything. I'm using the logging module and RotatingFileHandler, so the
service should start logging into a new file immediately after startup.
According to the event log, the service is started, but it does nothing.
If I start the same program as an application, it works fine. The
program only uses the standard lib. Any ideas, what can be the problem?
Services usually run under the LOCAL_SERVICE account, which is rather
limited on what it is allowed to do (It has no access to network shares,
by example). Perhaps this is afecting your program.

--
Gabriel Genellina

Feb 13 '07 #4
Services usually run under the LOCAL_SERVICE account, which is rather
limited on what it is allowed to do (It has no access to network shares,
by example). Perhaps this is afecting your program.
I'm sorry, it is not. My service only uses the standard output, writes
into different files and uses the http and https protocol. It does not
use microsoft networking, only TCP/IP. It is actually a spider that
downloads information from some web sites. The most strange thing is
that the main thread is enclosed in a try - except statement, and it
should log all exceptions into a file. The file is even not created, and
I see no way to debug it. Can a python win32 service program be debugged?

Thanks,

Laszlo
Feb 13 '07 #5
En Tue, 13 Feb 2007 16:49:10 -0300, Laszlo Nagy
<ga*****@designaproduct.bizescribió:
>Services usually run under the LOCAL_SERVICE account, which is rather
limited on what it is allowed to do (It has no access to network shares,
by example). Perhaps this is afecting your program.
I'm sorry, it is not. My service only uses the standard output, writes
into different files and uses the http and https protocol. It does not
use microsoft networking, only TCP/IP. It is actually a spider that
downloads information from some web sites. The most strange thing is
that the main thread is enclosed in a try - except statement, and it
should log all exceptions into a file. The file is even not created, and
I see no way to debug it. Can a python win32 service program be debugged?
Do you catch all exceptions on your working thread too? You didn't post
that code.

--
Gabriel Genellina

Feb 13 '07 #6
Laszlo Nagy wrote:
>
Hello,

I wrote a small program that uses xmlrpc over https. It should work as a
win32 application and as a win32 service too. There is a file called
Processor.py that contains the main thread of the program. It is called
from two files: win32_Application.py and win32_Service.py. The
application works perfectly. The service does not. I can start it from
the services mmc console, but it does not created logfiles, and does
nothing. It cannot be stopped and I have to kill pythonservice.exe. The
event log shows this:
Information: The AmazonOfferDownloaderService service has started.
Application error: Faulty application: python.exe, version: 0.0.0.0,
faulty modul: _ssl.pyd, version: 0.0.0.0, memory address: 0x00019b87.

Is it possible that my _ssl.pyd is faulty? Please help me.

Python version: 2.4.3 (#69, Mar 29 2006)
Windows version: Windows XP Professional, service pack 2, Hungarian (I
translated the above messages from the event log....)

Thanks,

Laszlo

>>>Here is the code for the application:

import thread,threading,time

from Processor import *
from servicelog import *
from win32_Config import *

stopped = threading.Event()
stopped.clear()
processor = Processor(stopped)
thread.start_new_thread(processor.Process,())
logger = getLogger('win32_Application')
logger.info("Staring as application. Please press CTRL+C to stop service.")
while 1:
try:
time.sleep(1)
except:
break
logger.info("Stopping application " + SERVICE_NAME)
stopped.set()
while not processor.stopped.isSet():
logger.debug("Waiting for the processor to finish...")
time.sleep(1)

logger.info("Application stopped.")
>>>Here is the code for the service:

from win32_Config import *
from Processor import *
from servicelog import *

import win32serviceutil, win32service
import pywintypes, win32con, winerror
from win32event import *
from win32file import *
from win32pipe import *
from win32api import *
from ntsecuritycon import *

import traceback
import thread,threading

class Service(win32serviceutil.ServiceFramework):
_svc_name_ = SERVICE_NAME
_svc_display_name_ = SERVICE_DISPLAY
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.stopped = threading.Event()
self.stopped.clear()
self.logger = getLogger(SERVICE_NAME)

def SvcStop(self):
self.logger.info("Got SvcStop, trying to stop service...")
self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING)
self.stopped.set()

def SvcDoRun(self):
"""Write an event log record - in debug mode we will also see
this message printed."""
try:
import servicemanager
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)
self.logger.info("Started.")
self.logger.debug("Creating processor instance")
processor = Processor(self.stopped)
self.logger.debug("Starting processor thread")
thread.start_new_thread(processor.Process,())
self.logger.debug("Waiting for the processor thread to finish")
self.stopped.wait()
self.logger.debug("Stopping")
time.sleep(1)
while not processor.stopped.isSet():

self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING, 5000)
time.sleep(5)
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, "")
)
self.logger.info("Stopped")
except:
self.logger.error('',exc_info = sys.exc_info())
if __name__=='__main__':
win32serviceutil.HandleCommandLine(Service)

I see some problems. You don't use time sleep in services. You wait for a
stop signal and if you don't get it by the time you reach your timeout,
you loop. I'm not sure what you are trying to accomplish with the threading
module, but you should start with a simple service first. I don't think you
will need the threading at all. Here is a skeleton that might help:

class Service(win32serviceutil.ServiceFramework):
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.timeout=5000 # 5000 milliseconds or 5 seconds
#---------------------------------------------------------------------
# Create an event which we will use to wait on.
# The "service stop" request will set this event.
#---------------------------------------------------------------------
self.hWaitStop=win32event.CreateEvent(None, 0, 0, None)
return

def SvcStop(self):
#---------------------------------------------------------------------
# Before we do anything, tell SCM we are beginning the stop process.
#---------------------------------------------------------------------
self.ReportServiceStatus(win32service.SERVICE_STOP _PENDING)
#---------------------------------------------------------------------
# And set my event, note you don't stop here, you just set the flag
# so that you will exit from your while loop in SvcDoRun
#---------------------------------------------------------------------
win32event.SetEvent(self.hWaitStop)
return

def SvcDoRun(self):
import servicemanager
#---------------------------------------------------------------------
# Make entry in the event log that this service started
#---------------------------------------------------------------------
servicemanager.LogMsg(servicemanager.EVENTLOG_INFO RMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, ''))

while 1:
#-------------------------------------------------------------------
# Wait for service stop signal, if I timeout, loop again
#-------------------------------------------------------------------
rc=win32event.WaitForSingleObject(self.hWaitStop, self.timeout)
#
# Check to see if self.hWaitStop happened
#
if rc == win32event.WAIT_OBJECT_0:
#
# Stop signal encountered
#
break

else:
#
# Do your work here
#
pass

#--End while--
#---------------------------------------------------------------------
# Log stopped message to EventLog
#---------------------------------------------------------------------
servicemanager.LogMsg(servicemanager.EVENTLOG_INFO RMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, ''))

return

Note: I pieced this together from a working service, it has NOT been
tested. It should be VERY close.

If you don't have it already you might want to pick up a copy of
Python Programming on Win32 by Mark Hammond and Andy Robinson. It helped
me a LOT.

-Larry
Feb 13 '07 #7
Something I always found useful is to use the win32traceutil to set up
the trace debugging tool.
You can then see the output in the pythonwin trace collector tool.
This is very useful for
Python services and COM servers.

Best of luck,
Giles

Feb 14 '07 #8
On 14 Feb, 00:17, "Giles Brown" <giles_br...@hotmail.comwrote:
Something I always found useful is to use the win32traceutil to set up
the trace debugging tool.
You can then see the output in the pythonwin trace collector tool.
This is very useful for
Python services and COM servers.

Best of luck,
Giles
Eh? Wrong thread. Damn the new google groups interface!

Feb 14 '07 #9

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

Similar topics

2
by: Skip Montanaro | last post by:
I'm trying to build the released version of Python 2.3 on Solaris 8 for the first time. It has problems when building _ssl.so. The command generated is gcc -shared...
5
by: Fuzzyman | last post by:
I've written a Tkinter application and am bundling it using py2exe 0.5 Because of the inclusion of Tk/TCL the final package is rather large........ but why on earth in an anagram finder is...
1
by: Larry Bates | last post by:
Well I'm still on my "quest". I've been putting this off for quite some time because I KNEW it was going to be hard. I tried to wait a while to upgrade to let all these things become readily...
11
by: uid09012_ti | last post by:
Hi, i get the following error message when i use py2exe on my application: The following modules appear to be missing I've installed PyXML-0.8.4.win32-py2.4.exe. My version of python is...
17
by: rkusenet | last post by:
This sure looks like a troll, but IBM folks should go there and defend DB2 ...
11
by: Zoury | last post by:
Hi there! :O) I've noticed some strange behavior with the VS IDE. Here's two a can think of right now... but those are most fusstrating i've encountered. 1. Every now and then, I haven't...
0
by: Shaman | last post by:
hi, im working on this app that makes a treenode view out of data from an xml page, yet theres a few pieces of code that just will not get fixed by me. Anybody help me (code below 'Class...
4
by: Earl | last post by:
To upgrade or not? This, to me, is based upon whether or not Microsoft has -- at least -- fixed the buggy controls from VS2003: Combo (clearing and binding context issues) Checked ListBox...
9
by: Ryan | last post by:
Hi all, I'm playing with Lutz Roeders Reflector and have found several areas where I think there are issues in the framework libraries. I can't see how the following should work as expected and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.