(self, machine_name, en_counter_name, instance_name, counters)
return path
When handling non english versions, the counters don't work quite as documented.
        This is because strings like "Bytes Sent/sec" might appear multiple times in the
        english master, and might not have mappings for each index.

        Search each index, and make sure the requested counter name actually appears in
        the list of available counters; that's the counter we'll use.
When handling non english versions, the counters don't work quite as documented.
        This is because strings like "Bytes Sent/sec" might appear multiple times in the
        english master, and might not have mappings for each index.
When handling non english versions the counters don t work quite as documented . This is because strings like Bytes Sent / sec might appear multiple times in the english master and might not have mappings for each index .
def _make_counter_path(self, machine_name, en_counter_name, instance_name, counters):
        """
        When handling non english versions, the counters don't work quite as documented.
        This is because strings like "Bytes Sent/sec" might appear multiple times in the
        english master, and might not have mappings for each index.

        Search each index, and make sure the requested counter name actually appears in
        the list of available counters; that's the counter we'll use.
        """
        path = ""
        if WinPDHCounter._use_en_counter_names:
            """
            In this case, we don't have any translations.  Just attempt to make the
            counter path
            """
            try:
                path = win32pdh.MakeCounterPath(
                    (machine_name, self.class_name, instance_name, None, 0, en_counter_name)
                )
                self.logger.debug("Successfully created English-only path")
            except Exception as e:  # noqa: E722, B001
                self.logger.warning("Unable to create English-only path %s", e)
                raise
            return path

        counter_name_index_list = WinPDHCounter.pdh_counter_dict[en_counter_name]

        for index in counter_name_index_list:
            c = win32pdh.LookupPerfNameByIndex(None, int(index))
            if c is None or len(c) == 0:
                self.logger.debug("Index %s not found, skipping", index)
                continue

            # check to see if this counter is in the list of counters for this class
            if c not in counters:
                try:
                    self.logger.debug("Index %s counter %s not in counter list", index, text_type(c))
                except:  # noqa: E722, B001
                    # some unicode characters are not translatable here.  Don't fail just
                    # because we couldn't log
                    self.logger.debug("Index %s not in counter list", index)

                continue

            # see if we can create a counter
            try:
                path = win32pdh.MakeCounterPath((machine_name, self.class_name, instance_name, None, 0, c))
                break
            except:  # noqa: E722, B001
                try:
                    self.logger.info("Unable to make path with counter %s, trying next available", text_type(c))
                except:  # noqa: E722, B001
                    self.logger.info("Unable to make path with counter index %s, trying next available", index)
        return path
def _make_counter_path ( self , machine_name , en_counter_name , instance_name , counters ) : path = "" if WinPDHCounter . _use_en_counter_names : """
            In this case, we don't have any translations.  Just attempt to make the
            counter path
            """ try : path = win32pdh . MakeCounterPath ( ( machine_name , self . class_name , instance_name , None , 0 , en_counter_name ) ) self . logger . debug ( "Successfully created English-only path" ) except Exception as e : # noqa: E722, B001 self . logger . warning ( "Unable to create English-only path %s" , e ) raise return path counter_name_index_list = WinPDHCounter . pdh_counter_dict [ en_counter_name ] for index in counter_name_index_list : c = win32pdh . LookupPerfNameByIndex ( None , int ( index ) ) if c is None or len ( c ) == 0 : self . logger . debug ( "Index %s not found, skipping" , index ) continue # check to see if this counter is in the list of counters for this class if c not in counters : try : self . logger . debug ( "Index %s counter %s not in counter list" , index , text_type ( c ) ) except : # noqa: E722, B001 # some unicode characters are not translatable here.  Don't fail just # because we couldn't log self . logger . debug ( "Index %s not in counter list" , index ) continue # see if we can create a counter try : path = win32pdh . MakeCounterPath ( ( machine_name , self . class_name , instance_name , None , 0 , c ) ) break except : # noqa: E722, B001 try : self . logger . info ( "Unable to make path with counter %s, trying next available" , text_type ( c ) ) except : # noqa: E722, B001 self . logger . info ( "Unable to make path with counter index %s, trying next available" , index ) return path