CyrilleB79 / charInfo

This addon for NVDA screen reader provides detailed character information when pressing four times the review current character gesture.
GNU General Public License v2.0
1 stars 4 forks source link

Add UnicodeData2 for Python 3.8 #3

Closed lukaszgo1 closed 3 years ago

lukaszgo1 commented 3 years ago

this pull request adds UnicodeData2 for Python 3;8 to prepare for NVDA 2021.1. While at it I've also refactored the way in which version of the UnicodeData for the current Python version is searched - with the previous approach version for Python 3.7 was imported under Python 3.8 causing a crash.

Since there is no official version of NVDA powered by Python 3.8 this can be tested as follows:

CyrilleB79 commented 3 years ago

Thanks @lukaszgo1 for this PR. I will review it when NVDA alpha switches to Python 3.8. So be patient...

lukaszgo1 commented 3 years ago

trouble is that with the implementation which is currently in master as soon as someone starts version of NVDA based on Python 3.8 and CharInfo installed NVDA attempts to import UnicodeData2 for Python 3.7 and crashes completely, so reviewing and merging it earlier than that might make more sense.

CyrilleB79 commented 3 years ago

OK, thanks for insisting on this point. This fully makes sense.

Did you test this PR on a Python 3.8 build? If yes, can you give some refs to set-up such an environment? (any branch in NVAccess repo or in Joseph's repo?). Thanks. Please specify the environment in which it was tested in the initial PR description. Thanks.

lukaszgo1 commented 3 years ago

Yes, I did. The initial description is updated.

CyrilleB79 commented 3 years ago

Thanks for the tips to run Python 3.8 NVDA. I have tried to run the current version of the add-on with NVDA Python 3.8.

You write:

with the previous approach version for Python 3.7 was imported under Python 3.8 causing a crash.

On my side, I do not experiment this crash. The add-on just fails to load with the following error:

ERROR - globalPluginHandler.listPlugins (00:40:04.497) - MainThread (2656):
Error importing global plugin charinfo
Traceback (most recent call last):
File "globalPluginHandler.py", line 23, in listPlugins
plugin = importlib.import_module("globalPlugins.%s" % name, package="globalPlugins").GlobalPlugin
File "C:\Users\Cyrille\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Cyrille\AppData\Roaming\nvda\addons\charInfo\globalPlugins\charinfo\__init__.py", line 37, in <module>
import unicodedata2 as unicodedata
ModuleNotFoundError: No module named 'unicodedata2'

Do you have any explanation?.

In any case, I have reviewed this PR and it seems good to me. So I will merge it. Thanks.

lukaszgo1 commented 3 years ago

Thanks for the tips to run Python 3.8 NVDA. I have tried to run the current version of the add-on with NVDA Python 3.8.

You write:

with the previous approach version for Python 3.7 was imported under Python 3.8 causing a crash.

On my side, I do not experiment this crash. The add-on just fails to load with the following error:

ERROR - globalPluginHandler.listPlugins (00:40:04.497) - MainThread (2656):
Error importing global plugin charinfo
Traceback (most recent call last):
File "globalPluginHandler.py", line 23, in listPlugins
plugin = importlib.import_module("globalPlugins.%s" % name, package="globalPlugins").GlobalPlugin
File "C:\Users\Cyrille\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Cyrille\AppData\Roaming\nvda\addons\charInfo\globalPlugins\charinfo\__init__.py", line 37, in <module>
import unicodedata2 as unicodedata
ModuleNotFoundError: No module named 'unicodedata2'

Do you have any explanation?.

Thanks for testing. It turns out CharInfo was not the cause of the crash I'm experiencing after all. I've assumed that it's caused by it since when running with my usual config NVDA under Python 3.8 failed to start and after installing add-on with the fix from this PR it no longer does but these tests were performed on a different configurations - for the first one I've tested a self compiled binary build, and then after experiencing a crash I've just assumed that it is caused by your add-on created a fix and tested from source with no crash. Now I'll need to investigate why binary versions of Py3.8 NVDA crashes on my system but this has nothing to do with this PR. Sorry for a false alarm.

CyrilleB79 commented 3 years ago

OK thanks for this clarification.