davidacm / NVDA-IBMTTS-Driver

This project is aimed at developing and maintaining the NVDA IBMTTS driver. IBMTTS is a synthesizer similar to Eloquence. Please send your ideas and contributions here!
GNU General Public License v2.0
56 stars 23 forks source link

Python 3.11 compatibility #105

Closed CyrilleB79 closed 10 months ago

CyrilleB79 commented 10 months ago

This PR fixes issues with this add-on when run with Python 3.11 (last alpha).

Issues

  1. An error in the add-on update system:
ERROR - globalPluginHandler.initialize (11:18:49.285) - MainThread (17360):
Error initializing global plugin <class 'globalPlugins.ibmtts.GlobalPlugin'>
Traceback (most recent call last):
  File "globalPluginHandler.py", line 32, in initialize
    runningPlugins.add(plugin())
                       ^^^^^^^^
  File "C:\Users\Cyrille\AppData\Roaming\nvda\addons\IBMTTS\globalPlugins\ibmtts.py", line 165, in __init__
    updateHandler.updateTimer()
  File "C:\Users\Cyrille\AppData\Roaming\nvda\addons\IBMTTS\globalPlugins\_ibmttsUtils.py", line 384, in updateTimer
    self.timer = callLater(nextTime, self.autoCheckUpdate)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "core.py", line 929, in callLater
    return wx.CallLater(delay, _callLaterExec, callable, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cyrille\Documents\DevP\GIT\nvda\.venv\Lib\site-packages\wx\core.py", line 3471, in __init__
    self.Start()
  File "C:\Users\Cyrille\Documents\DevP\GIT\nvda\.venv\Lib\site-packages\wx\core.py", line 3492, in Start
    self.timer.Start(self.millis, wx.TIMER_ONE_SHOT)
TypeError: Timer.Start(): argument 1 has unexpected type 'float'
  1. A deprecation warning from Python 3.11
    DEBUGWARNING - Python warning (11:17:13.460) - MainThread (3284):
    C:\Users\Cyrille\AppData\Roaming\nvda\addons\IBMTTS\synthDrivers\_ibmeci.py:377: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
    self.setDaemon(True)

Solutions

  1. Since an integer value is now required for core.callLater, convert the value to int.
  2. Use the daemon attribute as requested.

Note

To ensure continuity of automatic update, it's important to release a version of this add-on with the update system fixed before people are able to upgrade to NVDA 2024.1 (or even better before 2024.1beta1)

davidacm commented 10 months ago

Hi @CyrilleB79, I need to update a lot of things of my add-ons, I've been in no good personal situations and I had to prioritize my fundamental activities. Thank you for the contributions. About this PR, I would prefer to preserve compatibility with older versions of NVDA, so, I will look for a solution that can work from the NVDA 2019.3 to 2024.1. In the future, I will remove the compatibility code, but for now, I think is not a good idea to stop supporting older NVDA versions.

CyrilleB79 commented 10 months ago

@davidacm, to clarify: This PR makes the add-on compatible with NVDA Python 3.11 alpha versions, but it does not break the compatibility with Python 3.7:

I have run NVDA 2019.3 with this version of the add-on and it is working well.