Skip to content

AttributeError: 'NoneType' object has no attribute 'replace' in normalizeLanguage when using a SAPI4 synthesizer (WinTalker Voice) #20080

Description

@lpintes

Brief summary

When using a SAPI4 synthesizer (specifically WinTalker Voice, a SAPI4
synthesizer for Czech and Slovak), NVDA repeatedly logs an AttributeError
originating from getSpeechSequenceWithLangs ->
synthDriverHandler.languageIsSupported -> languageHandler.normalizeLanguage.
The error fires during normal speech output, e.g. character echo while
pressing keys, or while reviewing text with arrows in the Log Viewer.

The traceback is:

ERROR - extensionPoints.Filter.apply (16:38:14.045) - MainThread (9576):
Error running handler <function getSpeechSequenceWithLangs at 0x000002E9F4978220> for <extensionPoints.Filter object at 0x000002E9F49A02F0>
Traceback (most recent call last):
  File "extensionPoints\__init__.pyc", line 117, in apply
  File "extensionPoints\util.pyc", line 230, in callWithSupportedKwargs
  File "speech\languageHandling.pyc", line 39, in getSpeechSequenceWithLangs
  File "synthDriverHandler.pyc", line 349, in languageIsSupported
  File "languageHandler.pyc", line 457, in normalizeLanguage
AttributeError: 'NoneType' object has no attribute 'replace'

Root cause analysis:

SynthDriver.languageIsSupported (source/synthDriverHandler.py) iterates
self.availableLanguages and calls
languageHandler.normalizeLanguage(availableLang). With this SAPI4 driver
and WinTalker Voice, at least one entry in availableLanguages is None,
causing lang.replace("-", "_") in normalizeLanguage to fail.

This code path was introduced in PR #17685 ("Report the language of the text
been read"), which added getSpeechSequenceWithLangs and the
languageIsSupported call.

Steps to reproduce

  1. In NVDA settings, select WinTalker Voice (a SAPI4 synthesizer) as the
    active synthesizer.
  2. Make sure "Automatic language switching" and/or "Report language" is
    enabled (default speech settings are sufficient).
  3. Type any character into a text field with character echo enabled, or
    open the Log Viewer (NVDA+F1) and review text with arrow keys.
  4. Open the NVDA log and observe the error entries.

Actual behavior

The log fills with repeated AttributeError: 'NoneType' object has no attribute 'replace' entries, one per affected speech sequence. The error
is raised inside the getSpeechSequenceWithLangs filter handler, so the
filter is effectively bypassed for those sequences.

Expected behavior

languageIsSupported should tolerate None/invalid entries returned by
availableLanguages (or normalizeLanguage should be guarded at the
caller) and not raise. No errors should be logged during normal speech
output with a SAPI4 synthesizer.

NVDA logs, crash dumps and other attachments

Traceback included above. Full log can be attached on request.

NVDA type

portable copy

NVDA version

alpha-55754,364c1095 (2026.2.0.55754)

Have you tried any other versions of NVDA? If so, please report their behaviors.

This regression appears to have been introduced by PR #17685 (merged
2025-06-24), which added the languageIsSupported call in the new
getSpeechSequenceWithLangs filter. Versions before that PR do not exhibit
this error.

Windows version

Windows 11 Pro 10.0.26100

Name and version of other software in use when reproducing the issue

WinTalker Voice (SAPI4 synthesizer for Czech and Slovak), installed as a
standalone program (regular setup.exe, not an NVDA add-on).

Other information about your system

n/a

Does the issue still occur after restarting your computer?

I have restarted my computer and the issue still occurs

If NVDA add-ons are disabled, is your problem still occurring?

I do not have any NVDA add-ons installed

Does the issue still occur after you run the System Accessibility Repair Tool (COM Registration Fixing Tool in older versions) in NVDA's tools menu?

I have run the System Accessibility Repair Tool and the issue still occurs

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/speech-synth-driversgood first issuegithub features these at https://github.com/nvaccess/nvda/contributep3https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#prioritytriagedHas been triaged, issue is waiting for implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions