[pywin32-bugs] [ pywin32-Bugs-918016 ] Services fail on mapped network drives
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2004-03-17 13:47:41
|
Bugs item #918016, was opened at 2004-03-17 13:47 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=918016&group_id=78018 Category: pythonwin Group: None Status: Open Resolution: None Priority: 5 Submitted By: Martijn Ras (headhunter) Assigned to: Nobody/Anonymous (nobody) Summary: Services fail on mapped network drives Initial Comment: 1) Share the root of your drive C. 2) Map the network drive. 3) Create the following three files in the root of your drive C Note: Replace the following in the python script files: <LOCALHOST> with the name of your machine, <SHARE> with the share name you specified in step 1), <MAPPEDDRIVE> with the drive you specified in step2). 4) Run 'python execfile_test.py', it will print "dit is een test" three times, as expected. 5) Install the service 'python execfile_test_server.py install'. 6) Open the services control panel: a) change the logon so the service run under an account that has sufficient rights on the mapped network drive. b) start the service. 7) Open the EventViewer, select the Application log. You'll notice "dit is een test" has been logged twice and the third loggin an IOError 'No such file or directory'. :::::::::::::: config.txt :::::::::::::: config = 'dit is een test' :::::::::::::: execfile_test.py :::::::::::::: config = {} execfile('C:\config.txt', config) print str(config['config']) execfile('\\<LOCALHOST>\<SHARE>\config.txt', config) print str(config['config']) execfile('<MAPPEDDRIVE>:\config.txt', config) print str(config['config']) :::::::::::::: execfile_test_server.py :::::::::::::: import exceptions import os import pywintypes import win32api import win32con import win32event import win32file import win32pipe import win32security import win32service import win32serviceutil class execfile_test_server(win32serviceutil.ServiceFramework): _svc_name_ = 'execfile_test_server' _svc_display_name_ = 'execfile_test_server' def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.overlapped = pywintypes.OVERLAPPED() self.overlapped.hEvent = win32event.CreateEvent(None,0,0,None) self.thread_handles = [] def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): import servicemanager # Write an event log record indicating we have started servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) config = {} execfile('C:\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile('\\<LOCALHOST>\<SHAREDFOLDER>\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile('<SHAREDFOLDER>:\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) # Write another event log record we have stopped servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, '')) if __name__=='__main__': win32serviceutil.HandleCommandLine(execfile_test_server) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=918016&group_id=78018 |