[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-05 10:59:09
|
Bugs item #1731295, was opened at 2007-06-05 16:25 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=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: Open Resolution: None 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) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1731295&group_id=78018 |