Jason R. Coombs avatar Jason R. Coombs committed 2909bd2

Fixed errors with whois module on Windows

Comments (0)

Files changed (1)


 import select
 import SocketServer
+import jaraco.util.logging
 from ClientForm import ParseResponse, ItemNotFoundError
 from BeautifulSoup import BeautifulSoup, UnicodeDammit
 from jaraco.util.meta import LeafClassesMeta
 	import win32service
 	import win32serviceutil
-	import win32event
+	import servicemanager
 except ImportError:
 	"""This is not a typical Whois handler, but rather a special
 	handler that returns the source of this file"""
 	services = r'^source$'
 	def LoadHTTP(self): pass
 	def ParseResponse(self, s_out):
 		filename = os.path.splitext(__file__)[0] + '.py'
 		def SvcDoRun(self):
-			import servicemanager
 			log.info('%s service is starting.', self._svc_display_name_)
 		def _setup_logging(self):
-			from jaraco.util import TimestampFileHandler, LogFileWrapper
 			logfile = os.path.join(os.environ['WINDIR'], 'system32', 'LogFiles', self._svc_display_name_, 'events.log')
-			handler = TimestampFileHandler(logfile)
+			handler = jaraco.util.logging.TimestampFileHandler(logfile)
 			handlerFormat = '[%(asctime)s] - %(levelname)s - [%(name)s] %(message)s'
 			# if I don't redirect stdoutput and stderr, when the stdio flushes,
 			#  an exception will be thrown and the service will bail
-			sys.stdout = LogFileWrapper('stdout')
-			sys.stderr = LogFileWrapper('stderr')
+			sys.stdout = jaraco.util.logging.LogFileWrapper('stdout')
+			sys.stderr = jaraco.util.logging.LogFileWrapper('stderr')
 			logging.root.level = logging.INFO
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.