[pywin32-bugs] [ pywin32-Bugs-1731295 ] _GetServiceShortName doesn't work with non-ascii characters
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2007-06-30 04:46:19
|
Bugs item #1731295, was opened at 2007-06-05 05:55 Message generated for change (Settings changed) made by rupole You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1731295&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Shailesh Kumar (shailesh1729) Assigned to: Nobody/Anonymous (nobody) Summary: _GetServiceShortName doesn't work with non-ascii characters Initial Comment: This problem came up when running on a Japanese computer. I was calling QueryServiceStatus for a non-existent service. My code ran like: def serviceExists(serviceName): exists = True try: status = win32serviceutil.QueryServiceStatus(serviceName) except win32api.error, (rc, fnerr, msg): exists = False if exists: logging.info('%s service exists.' % serviceName) else: logging.info("%s service doesn't exist" % serviceName) return exists On english computers, this worked fine. On a Japanese computer, it led to following exception. File "C:\Python24\Lib\site-packages\win32\lib\win32serviceutil.py", line 479, in QueryServiceStatus hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_QUERY_STATUS) File "C:\Python24\Lib\site-packages\win32\lib\win32serviceutil.py", line 81, in SmartOpenService name = _GetServiceShortName(name) File "C:\Python24\Lib\site-packages\win32\lib\win32serviceutil.py", line 66, in _GetServiceShortName if thisName.lower() == longName: UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 4: ordinal not in range(128) ---------------------------------------------------------------------- >Comment By: Roger Upole (rupole) Date: 2007-06-29 23:46 Message: Logged In: YES user_id=771074 Originator: NO Rev 1.25 of win32serviceutil.py uses GetServiceKeyName which handles unicode ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1731295&group_id=78018 |