Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] PSUTIL service lookup having unicode issue with special characters - (Č) to be specific #2506

Open
MrPippin66 opened this issue Feb 19, 2025 · 0 comments

Comments

@MrPippin66
Copy link

MrPippin66 commented Feb 19, 2025

Summary

  • OS: Windows Server
  • Architecture: x86
  • Psutil version: 6.1.1
  • Python version: 3.6.8
  • Type: core

Description

From Nagios NCPA.

There is apparent Unicode issue with the service status check for psutil.

Service names that have a non-standard UTF character will fail a lookup in service status:

File "psutil_pswindows.py", line 628, in status
File "psutil_pswindows.py", line 558, in _query_status
File "contextlib.py", line 158, in exit
File "psutil_pswindows.py", line 583, in _wrap_exceptions
psutil.NoSuchProcess: service 'ČSOB Business Connector' does not exist (name='ČSOB Business Connector')

I note that PSUTIL in the service iteration is doing a Unicode conversion.

PyUnicode_FromWideChar(*)

But...when looking up a specific service, it's not doing the transverse, which may be what causes this problem

    def description(self):
        """Service long description."""
        return cext.winservice_query_descr(self.name())

AKA, converting self.name() via PyUnicode_AsWideChar(*) back to wchar format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant