Skip to content

UnicodeDecodeError psutil.win_service_iter() #866

Closed
@FabioBaroni

Description

I have this function for retrieving and displaying info about all the Windows services.

def enum_service():
    for service in psutil.win_service_iter():
        sinfo = service.as_dict()
        print("[*] Name: {} Display name: {} Status: {} Type: {} Path: ".format(sinfo["name"], sinfo["display_name"], sinfo["status"], sinfo["start_type"], sinfo["binpath"]))

I get an error at line 342 of psutil_pswindows.py, in win_service_iter
for name, display_name in cext.winservice_enumerate():
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 7: invalid continuation byte

It seems that one or more values aren't encoded in utf-8 so it throws an error.
Is it a known issue? Can it be fixed?

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions