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

Supporting 2024.1 #40

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Supporting 2024.1 #40

wants to merge 2 commits into from

Conversation

rmcpantoja
Copy link
Contributor

@rmcpantoja rmcpantoja commented Apr 2, 2024

NVDA 2024.1 has been released. Big changes are the update of Python 3.11.
In this branch, I provide proposal changes to make compatible with 2024.1. *.pyd libraries are updated to Python 3.11 win32 as well.
Closes #33
Closes #39

@KiON-GiON
Copy link

Hi,

There is still a bug in the initialization of the add-on. Piper can't connect to the GRPC server.

INFO - external:synthDrivers.piper_neural_voices.aio._thread_target (20:25:28.311) - piper4nvda_asyncio (6596):
Starting asyncio event loop
ERROR - external:synthDrivers.piper_neural_voices.SynthDriver.check (20:25:28.312) - MainThread (8196):
Failed to connect to piper GRPC server. Synthesizer will not be available.
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\__init__.py", line 174, in check
    piper_grpc_server_version = grpc_client.check_grpc_server().result()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "concurrent\futures\_base.pyc", line 456, in result
  File "concurrent\futures\_base.pyc", line 401, in __get_result
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\grpc_client\__init__.py", line 107, in check_grpc_server
    return await asyncio.wait_for(
                 ^^^^^^^
NameError: name 'asyncio' is not defined

@ultrasound1372
Copy link

Really, you need to stop bundling asyncio, or at least stop loading it in 2024.1from said bundle, and make the code compatible with Python 3.11's asyncio. The main thing is that the loop keyword is removed in a few places, deprecated in 3.10. It does still let you spawn custom event loops, I'm unsure how exactly you replace the functionality. Maybe Python documentation in the deprecation section tells you how. Attempting to import the bundled asyncio runs into a kind of import error with one of the pyd files even if you update them, because the module is already bundled in the standard library and you have a DLL import conflict.

@rmcpantoja
Copy link
Contributor Author

Hi @KiON-GiON and @ultrasound1372,

  1. Thanks for your findings.
  2. Yeah I did exactly you said. I removed asyncio package and his bundled import and removed loop argument in one of scripts of GRPC client, and updating python37 to python311 pyd modules as python3.dll as well. I reviewed the asyncio documentation before making this PR. Otherwise, what would be the point of doing this?

I will push a commit fixing bugs found by me and the pointed one by @KiON-GiON in a few hours.

@rmcpantoja
Copy link
Contributor Author

Hi,

There is still a bug in the initialization of the add-on. Piper can't connect to the GRPC server.

INFO - external:synthDrivers.piper_neural_voices.aio._thread_target (20:25:28.311) - piper4nvda_asyncio (6596):
Starting asyncio event loop
ERROR - external:synthDrivers.piper_neural_voices.SynthDriver.check (20:25:28.312) - MainThread (8196):
Failed to connect to piper GRPC server. Synthesizer will not be available.
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\__init__.py", line 174, in check
    piper_grpc_server_version = grpc_client.check_grpc_server().result()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "concurrent\futures\_base.pyc", line 456, in result
  File "concurrent\futures\_base.pyc", line 401, in __get_result
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\grpc_client\__init__.py", line 107, in check_grpc_server
    return await asyncio.wait_for(
                 ^^^^^^^
NameError: name 'asyncio' is not defined

Hi @KiON-GiON,
Please try the latest commit.
I had the asyncio fix in my local copy of the add-on, but not in the one in the repo. Sorry. Now I made sure to put it here now.
Also, I did another compatibility fix to handle an exception.
So, this will go from a draft pull request to open.

@rmcpantoja rmcpantoja marked this pull request as ready for review April 3, 2024 13:06
@mikebayus
Copy link

Where do I download this?

I only see the October 23,2023 release on the Release page.

@rmcpantoja
Copy link
Contributor Author

Hi @mikebayus.
No, this isn't in releases page yet, because the pull request needs to merge first. This is ready to merge, at least that someone find more bugs. Download from this artifact with the latest fixes: https://github.com/mush42/piper-nvda/actions/runs/8539138528/artifacts/1381177553

@mikebayus
Copy link

mikebayus commented Apr 3, 2024 via email

@KiON-GiON
Copy link

Thanks @rmcpantoja, it seems it works successfully now.

@KiON-GiON
Copy link

I found a little bug/quirk. It affects UI interfaces with ccheckboxes and/or buttons (not all of them), let's see, for example, NVDA settings panel.

  1. Select Piper Neural Voices..
  2. Open the NVDA menu.
  3. Navigate to any section of the menu.
  4. Before the voice stops speaking, press ctrl, and it will speak a letter instead of just stopping.

For example, when I navigate to "Preferences subMenu" and I stop the speech with ctrl, instead of stopping completely, it says the "P" letter.

@mush42
Copy link
Owner

mush42 commented Apr 4, 2024

Hi @rmcpantoja

I did all the changes locally about 2 months ago, but I wasn't able to push them due to personal troubles.

I'll push them very soon and do a release.

@rmcpantoja
Copy link
Contributor Author

Hi @rmcpantoja

I did all the changes locally about 2 months ago, but I wasn't able to push them due to personal troubles.

I'll push them very soon and do a release.

HI @mush42
No worries. I understand your situation. Take your time to push it. If you need help, I'm here.

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