Win98 - exceptions.IOError: (13, 'Permission denied')

  • Thread starter Robert Dollinger
  • Start date
R

Robert Dollinger

Hi to everyone,

I have a Service, that runs on a WinXP machine. The service read a file
on a Win98 machine and write the content in a file on the WinXP machine.
After tree times I get the error message exceptions.IOError: (13,
'Permission denied').

The following things I have already tested:

- The file on Win98 machine could be deleted, so the file is closed
correctly.
- Stop an restart the service on WinXP, will have no effect
- Reboot the Win98 machine solve the problem for three times. So I have
the same issue explained above.
- I have changed the intervall from 5 sec to 1 minute. After ther first
time I get the error message.
- Using a Win2000 or WINXP machine instead of the Win98 machine. That
works. But unfortunatly the PC to access is a Win98 and I have no
influence to decide for upgrade.

I can't figure out, what's the problem.

This is the code to simulate my actual problem:

# -*- coding: iso-8859-1 -*-

import win32serviceutil
import win32service
import win32event
import pywintypes
import win32file
import win32pipe
import win32api
import win32con
import thread
import ntsecuritycon
import os
import sys

class MyService(win32serviceutil.ServiceFramework):
"""NT Service."""

_svc_name_ = "TCTest"
_svc_display_name_ = "TCTest"

def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.stop_event = win32event.CreateEvent(None, 0, 0, None)
self.overlapped = pywintypes.OVERLAPPED()
self.overlapped.hEvent = win32event.CreateEvent(None,0,0,None)
self.thread_handles = []

def SvcDoRun(self):
import servicemanager

servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)

while 1:
datei = open(r'\\ipcwin98\test\test.txt', 'r')
log = open(r'c:\log.txt', 'a')
log.write(datei.read())
datei.close()
log.close()

if win32event.WaitForSingleObject(self.stop_event, 5000) ==
win32event.WAIT_OBJECT_0:
break

servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, '')
)

def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.stop_event)

if __name__ == '__main__':
win32serviceutil.HandleCommandLine(MyService)


Thanks in advanced for your help.
bye
Robert
 

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
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top