Giter Site home page Giter Site logo

natlink's Introduction

dictation-toolbox

Meta-repository for tracking and providing information about the organization itself.

Summary

dictation-toolbox is a loose organization intended to organize projects for users of voice recognition software, with a focus on customizability, flexibility, and programming/system administration/etc. We hope to help fill in the gap between commercially available solutions for common workflows and other workflows which require customization.

We also intend to provide a contingency plan for projects to be "adopted" by new maintainers if their current maintainers leave without transferring control of the project. Each repository in dictation-toolbox has one or more owners responsible for it, and admins of dictation-toolbox agree not to use their admin privileges on repositories where they are not an owner, except in the case of all owners dropping out of all contact for four months.

We are open to including other projects under these terms to better serve the needs of the dictation community. Please open an issue in this repository if you are interested. Historically, we have made all owners of all repositories in dictation-toolbox admins of the organization.

Projects

The listed owners of each project, rather than the admins of dictation-toolbox, retain full control and responsibility for all aspects of their project.

aenea

Owners: @calmofthestorm

Client-server library for using voice macros from Dragon NaturallySpeaking and Dragonfly on remote/non-windows hosts using NatLink and Dragonfly.

aenea-grammars

Owners: @calmofthestorm

A collection of grammars written for use with Aenea, with an eye toward programming and use on Linux.

dragonfly-scripts

Owners: @nirvdrum

This repository contains a collection of Dragonfly Python-scripts, that can be used with Dragon NaturallySpeaking Professional.

aenea-resources

Owners: @calmofthestorm

Miscellaneous resources (cheatsheets, etc) for working with aenea and aenea-grammars.

natlink's People

Contributors

dougransom avatar drmfinlay avatar fusentasticus avatar kb100 avatar kn0rk avatar lexiconcode avatar mrob95 avatar quintijn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

natlink's Issues

Grammar lists do not work correctly with Dragon 15 in some cases

Natlink's named/dynamic grammar list functionality does not work correctly with Dragon 15 if used in a stand-alone Python process. However, it works just fine in a command module loaded by natspeak.exe. The related methods are GramObj.appendList() and GramObj.emptyList().

The problem can be replicated by running my sample_list.py Natlink command module. The module will load without issue, but Dragon will fail to match a spoken or mimicked command to the grammar. If one says, for example, "this big red object is good," Dragon will normally output the spoken words instead. It would seem that Dragon is either not receiving or not setting the list words and therefore cannot recognize the command. If the module is loaded into natlink normally via the user directory, it will work properly.

This behaviour occurs in the older Python 2.7 and the newer Python 3.8 versions of Natlink.

I note that this can only be related to the C++ code since Dragonfly, which uses the GramObj class directly, has the same problem.

This issue, if it is indeed fixable and not another Dragon "quirk" we must simply endure, should be considered low priority since Natlink is not normally used in this fashion.

inputFromFile function can cause a segfault in some Dragon versions

While looking into daanzu/kaldi-active-grammar#23, I noticed that natlink's inputFromFile() function can cause a segmentation fault (i.e. a fatal process crash) in some Dragon versions. It crashes for me in Dragon Home 15, but not in the old version of Dragon 10 I still have. I'm wondering whether this can be fixed in Natlink or if it is a bug with Dragon.

This is the code I was testing with in a separate process to avoid crashing natspeak.exe:

import natlink

natlink.natConnect()
try:
    natlink.inputFromFile("testing.wav", 0, [], 0)
finally:
    natlink.natDisconnect()

The "testing.wav" file is a wave file I recorded with a 16 kHz sample rate, a signed 16-bit (LE) format and one recording channel. The recording contains only a single utterance, so I passed 0 for the uttDetect argument.

Interestingly, Dragon will still process the recorded audio if the function is used from a separate process, even if that process crashes.

Fail to lunch start_natlinkconfig.exe

On Windows 7, Python 3.8.10 lunching start_natlinkconfig.exe fail with following error:
Any help?

Traceback (most recent call last):
  File "c:\python38\lib\site-packages\natlinkcore\ConfigureNatlink\configurenatlink.pyw", line 1355, in <module>
    app = MyApp(True)
  File "C:\python38\lib\site-packages\wx\core.py", line 2137, in __init__
    self._BootstrapApp()
SystemExit: OnInit returned false, exiting...

No module named 'natlinkmain' error

Hello,

Recently, I've had to reinstall the operating system on my machine. In the process I upgraded my DNS from 13 to 15 and in reconfiguring my voice recognition environment the following Natlink message now appears on DNS start:

Failed to find Natlink key in Windows registry.
Failed to extract value from Natlink key.
An exception occurred loading 'natlinkmain' module
Error message:
No module named 'natlinkmain'

--

My DNS version: 15.61.200.010
My OS specifications:

Edition Windows 10 Pro
Version 20H2
Installed on ‎3/‎12/‎2021
OS build 19042.867
Experience Windows Feature Experience Pack 120.2212.551.0

--

To troubleshoot I have:

  1. Reinstall Python and Natlink several times to ensure that I'm installing correctly (per the instructions):

Python 3.8.8 (32-bit), all users, at C:\Python38-32

I also cleared system of all Python and Natlink remnants and restart operating system with each reinstall.

Everything I attempted was always with administrative privileges.

  1. Add additional path variables in the following order:
C:\Python38-32\Lib\site-packages\natlinkcore\
C:\Python38-32\Lib\site-packages\
C:\Python38-32\Scripts\
C:\Python38-32\
  1. Add the following registry entry:

added registry entry

This last effort produced this Natlink message:

An exception occurred loading 'natlinkmain' module
Error message:
no module named 'natlinkmain'
  1. Attempt to import natlinkmain:

import attempt

Line 113:

line 113

--

Additional information...

I did notice that on the first configuration of Natlink I would receive the following error message:

error message

The message in .natlink\configurenatlink_error.txt:

Traceback (most recent call last):
  File "c:\python38-32\lib\site-packages\natlinkcore\ConfigureNatlink\configurenatlink.pyw", line 1355, in <module>
    app = MyApp(True)
  File "C:\python38-32\lib\site-packages\wx\core.py", line 2137, in __init__
    self._BootstrapApp()
SystemExit: OnInit returned false, exiting...

The settings in natlinkstatus.ini:

[usersettings]

NatlinkPydOrigin = C:\Python38-32\Lib\site-packages\natlinkcore\PYD\natlink_3.8_Ver15.pyd

--

At this point I am out of ideas, and am wondering if you have come across this error message before, is it a known issue or maybe a new issue, or is there something that I am doing in my troubleshooting steps incorrectly? Thank you.

Natlink Unable to Open Config GUI

Hi- I'm a first time NatLink user doing my initial installation, following [this page ] (https://qh.antenna.nl/unimacro/installation/installationstableversionpython2.html). Here is a history of the steps taken for context:

  1. Installed Dragon Home 15.3
  2. Installed Natlink, then uninstalled after reading that I need Python 2.7 first (I have 3.7 installed currently).
  3. Install Python 2.7.16 (32bit) directly from python.org
  4. pip install: wxpython, pywin32, six, future.

ISSUE: When I try: Start > Configure NatLink via GUI, I get this error message:

Traceback (most recent call last):
  File "C:\Natlink\Natlink\confignatlinkvocolaunimacro\configurenatlink.pyw", line 1363, in <module>
    app = MyApp(True)
  File "C:\Python27\lib\site-packages\wx\core.py", line 2194, in __init__
    self._BootstrapApp()
SystemExit: OnInit returned false, exiting...

I've referenced this to @lexxish comment below because its the same error (with just slightly different file path), however there was no resolution on that thread.

PS- this is also my first GitHub post, so if you have any feedback on how to improve clarity, etc., I would be appreciative.

Many thanks!
Alex

The python 3 is still work in progress and unfortunately we have not (and might not be able to) create a stable ABI for python 3.X. Currently I am compiling to python 3.7 and @mrob95 is compiling to 3.8.

The goal is that it will work seem less with both versions eventually. Thanks for posting the work around.

I wanted to try python 3.6 because psychopy seems to work only with 3.6 but getting the below error. Any thoughts on why? I was thinking we could add some eye tracking features directly into caster with psychopy.

Traceback (most recent call last):
  File "configurenatlink.pyw", line 1363, in <module>
    app = MyApp(True)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wx\core.py", line 2194, in __init__
    self._BootstrapApp()
SystemExit: OnInit returned false, exiting...

Originally posted by @lexxish in #2 (comment)

No module named 'natlink' - kb100 Fork

@kb100 Upon starting Dragon

Natlink Version: 4.2
Python Version: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)]
An exception occurred loading 'natlink' module
NatLink: an exception occurred in 'natlink.redirect_all_output_to_natlink_window'.
Error message:
No module named 'natlink'
NatLink: an exception occurred in 'natlink.run_loader'.
Error message:
No module named 'natlink'

.natlink
C:\Users\Main

[directories]
my_scripts=D:\Backup\Library\Documents\Caster

[settings]
log_level=INFO

documentation error?

in readme.md:

pip install dragonfly (natlink also needs some action modules from dragonfly)

i think that is both wrong, and dragonfly2 is in the pyproject.toml so this step shouldn't be required?

No UserDirectory specified

Quitting the natlinkconfig_cli program allows me to delete natlink.pyd without admin permissions. Next time I start the program it registers successfully. Perhaps it keeps an open file handle while it is running? You can test it by running r twice in a row.

I uninstalled natlink 5.0.0 and installed it again with version 5.1.1. I get the same message in the natlink window saying "no UserDirectory specified".

Originally posted by @slatesky284 in dictation-toolbox/Caster#907 (comment)

Remove Python Path Requirements

It might be possible i remove the requirement for python to be in the system path. Somehow though the python dll in the correct folder needs to be located.

A possible solution:

You might be able to use an api https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-adddlldirectory (or others) to control which directories are serached for the DLL, before the DLL is loaded. The question is when the DLL is loaded?

Another idea:

  • remove the references to the python dll in visual studio and associated headers in the C++ code.
  • for the python dll calls we need, make functions pointers for them in a header somewhere.
  • use LoadLibrary to get the exact dll we need and getProceAddress to get the functions for the dlll calls we make. There are only a few that we use from python.h so this should be straightforward.

This might also alleviate the need to recompile for different versions of python (3.8, 3.9, etc) if that is a requirement now (it may not be, the dll may be compatible with all versions of python).

changeCallback at mic change does not hit when called from inside a grammar or test function

When in the test suite I try to toggle the microphone (for testing natlinkmain reloading behaviour), it turns out that the required callback function (changeCallback from natlinkmain) is only called after the finishing of the test function. When doing this in a simple grammar, the same behaviour is observed. I will add that example here too.

It is strange that before the testNatlinkmain passed, while it relies on the callback hitting at toggleMicrophone from the test program.

It is not clear to me how other things will be affected when this is repaired. In normal use I think the callback with microphone switching off or on manually, and new and changed grammars being loaded then, works fine.

In the cpp code there is mention that callbacks are protected against recursive callback calls, but I think this is not the case here. It has, is my guess, to do with threading.

Code Signing Natlink

Out side the user experience code signing provides authenticity and integrity to the installer.

  • Authenticity: This tells the user (and the computer) where the software came from.
  • Integrity: Demonstrates that the code has not been modified. The digital signature does not just tell devices who signed the software, but what they signed. This allows a computer to know if the code has been changed at all since it was signed. This will also alert users to file corruption which may happen during downloading.

Cost:
Note! Different providers may only signing certain file types.

certum 1st time fee - Open Source Code Signing - set €69.00/ $78.94 US
Renewal - Open Source Code Signing €25.00 / $28.60 US
image

comodosslstore $212.49 US - 3/ $66.66 per year
image

Code Signing Process
Code Signing Walkthrough

Using SignTool with inno
Providing SignTool configuration in Inno Setup script

We maybe able to set the certificate up for the dictation toolbox org instead of just natlink.

natlinkmain should start in a different way from natlink.pyd

Importing natlinkmain also invokes start_natlink(). This function should only be called explicitly, in particular when natlink.pyd is called from Dragon at startup.

It would be more smooth if start_natlink() is never called in natlinkmain, as is done now, according to the name variable, which is unreliable.

I see 2 possibilities:

  1. in AppSupp.cpp (in NatlinkSource/COM), around line 100, first natlinkmain is imported next natlinkmain.start_natlink() is called.

  2. a new module start_natlinkmain.py is made, first importing natlinkmain, and then calling natlinkmain.start_natlink(). My fear is there is come complication with global variables in natlinkmain.

So probably method 1 is better.

Who can implement this???

Quintijn

Remove `flit install --symlink` from readme

We need an alt for flit install --symlink for now use flit install

PS C:\Windows\system32> natlinkconfig_cli
Traceback (most recent call last):
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\natlinkstatus.py", line 284, in __init__
    self.__class__.NatlinkDirectory
AttributeError: type object 'NatlinkConfig' has no attribute 'NatlinkDirectory'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python38-32\Scripts\\natlinkconfig_cli", line 8, in <module>
    sys.exit(main())
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 2029, in main
    cli = CLI()
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 1345, in __init__
    self.config = NatlinkConfig()
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 185, in __init__
    natlinkstatus.NatlinkStatus.__init__(self, skipSpecialWarning=1)
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\natlinkstatus.py", line 289, in __init__
    self.__class__.NatlinkDirectory = self.getNatlinkDirectory(coreDir=coreDir)
  File "c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\natlinkstatus.py", line 1356, in getNatlinkDirectory
    raise OSError(f'site-packages is symlink! {coreDir}, resolved: {cdResolved}, return {coreDir}\ndo not use --symlink with flit install')
OSError: site-packages is symlink! c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore, resolved: C:\Users\MainLaptop\Documents\natlink\src\natlinkcore, return c:\users\mainlaptop\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore

Register Natlink in site-packages/scripts rather than the python source directory.

currently, natlink.pyd file is registered in site-packages/natlinkpy/...
Uninstalling natlink with pip results in the folders left in site-packages because the natlink.pyd file will not be removed by PIP.

It seems wiser to move the natlink.pyd file to site-packages, where remain harmless after natlink is removed with PIP -- at least until more sophisticated install strategy is pursued.

Beginner hurdles: Could not find wantedPydPath: C:\python38-32\lib\site-package\natlinkcore\PYD etc

Hi guys, that's the error message I get when trying to setup natlink !! BTW much thanks for keeping natlink alive! I think I've worked my way through the problems, but let me report. There seems to be a couple of easily fixed logic errors.

First Hurdle

  • I checked that C:\python38-32\Lib\site-packages\natlinkcore\PYD does indeed exist, so the error message does not make sense!
  • And the cryptic part of the error message"So if Dragon is running, close it" adds to my confusion.
  • I tried closing Dragon, even killed the service process.
  • Yes, I run in an elevated 'cmd' shell.
  • I have env variable: DICTATIONTOOLBOXUSER =D:\Dropbox\DictationToolBox
  • For full discombobulation, I'm prompted to start Dragon after the error message. So that implies that the installation is OK!

Now, I looked in the log tab (neat) and saw that the Dragon program itself could not be found. So I fixed that and verified that the DNS install path is filled out (in the info tab): nice -- it's there along with a file path. That apparently was the problem -- so I'm reporting that the error message was wrong.

Second Hurdle

Then, I close configuration program and I start Dragon, but it hangs and says:

image

I shut it down, recheck configuration and start Dragon again. This time it comes up! Not quite sure what happened.

Third Hurdle

OK, so how do I verify that the installation now works?

I want to proceed with installing Caster, just need to check that natlink is working before I continue. I do have a natlinkstatus file that says:

[usersettings]
DNSInstallDir = C:\Program Files (x86)\Nuance\NaturallySpeaking14

NatlinkPydOrigin = C:\python38-32\lib\site-packages\natlinkcore\PYD\natlink_3.8_UNICODE.pyd

NatlinkPythonExecutable = C:\python38-32\pythonw.exe
NatlinkmainDebugCallback = 1
NatlinkmainDebugLoad = 1
UserDirectory = D:\Dropbox\Natlink User

Error messages could ease troubleshooting: Natlink Key.

"Failed to find Natlink key in Windows registry.
Failed to extract value from Natlink key."

Someone setting up a dev environment or a user troubleshooting an install need more information.

Maybe display the registry key?
Maybe display "Workaround: add this folder natlink/.../... to Pythonpath".

Also should we be modifying a python key or should we have a Natlink key off Computer\HKEY_LOCAL_MACHINE\SOFTWARE? Might that just eliminate the problem altogether? Especially if you upgrade your python or something.

also shot

Hello,

Recently, I've had to reinstall the operating system on my machine. In the process I upgraded my DNS from 13 to 15 and in reconfiguring my voice recognition environment the following Natlink message now appears on DNS start:

Failed to find Natlink key in Windows registry.
Failed to extract value from Natlink key.
An exception occurred loading 'natlinkmain' module
Error message:
No module named 'natlinkmain'

--

My DNS version: 15.61.200.010
My OS specifications:

Edition Windows 10 Pro
Version 20H2
Installed on ‎3/‎12/‎2021
OS build 19042.867
Experience Windows Feature Experience Pack 120.2212.551.0

--

To troubleshoot I have:

  1. Reinstall Python and Natlink several times to ensure that I'm installing correctly (per the instructions):

Python 3.8.8 (32-bit), all users, at C:\Python38-32

I also cleared system of all Python and Natlink remnants and restart operating system with each reinstall.

  1. Add additional path variables in the following order:

C:\Python38-32\Lib\site-packages\natlinkcore
C:\Python38-32\Lib\site-packages
C:\Python38-32\Scripts
C:\Python38-32\

  1. Add the following registry entry:

added registry entry

This last effort produced this Natlink message:

An exception occurred loading 'natlinkmain' module
Error message:
no module named 'natlinkmain'

  1. Attempt to import natlinkmain:

import attempt

Line 113:

line 113

Additional information...

I did notice that on the first configuration of Natlink I would receive the following error message:

error message

Everything I attempted was always with administrative privileges.

The message in .natlink\configurenatlink_error.txt:

Traceback (most recent call last):
File "c:\python38-32\lib\site-packages\natlinkcore\ConfigureNatlink\configurenatlink.pyw", line 1355, in
app = MyApp(True)
File "C:\python38-32\lib\site-packages\wx\core.py", line 2137, in init
self._BootstrapApp()
SystemExit: OnInit returned false, exiting...

The settings in natlinkstatus.ini:

[usersettings]

NatlinkPydOrigin = C:\Python38-32\Lib\site-packages\natlinkcore\PYD\natlink_3.8_Ver15.pyd

--

At this point I am out of ideas, and am wondering if you have come across this error message before, is it a known issue or maybe a new issue, or is there something that I am doing in my troubleshooting steps incorrectly? Any help is greatly appreciated, as a developer who cannot use his hands, Natlink in combination with Dragonfly is a godsend. Seriously. Thank you.

Chris

getWave() not working with Python 3

I get a UnicodeDecodeError raised when I call getWave() in Python 3 (tested on 3.7 and 3.8). I'm using this grammar:
https://github.com/dwks/dragonfly-save-audio/blob/master/_natlink_save_audio.py

And I get this exception: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xac in position 29: invalid start byte

I've never built NatLink so I haven't tested this, but my hypothesis is that the bug is here:

PyObject * pData = Py_BuildValue( "s#", (char *)(sData.pData), sData.dwSize );

It looks like this should be y# instead of s#: https://docs.python.org/3/c-api/arg.html#strings-and-buffers

ElevationError running natlinkconfig_cli in cmd as administrator

My user is not an admin. Attempting to run natlinkconfig_cli in an elevated CLI yields still the error below.

Temporary workaround: Check "Run this program as an administrator" in the compatibility properties on the natlinkconfig_cli.exe file.

C:\Users\mrichar2>natlinkconfig_cli
pyd path "C:\Users\mrichar2\AppData\Roaming\Python\Python38\site-packages\natlinkcore\natlink.pyd" does not exist...
You need to run this program in elevated mode. (needed for copying the correct natlink.pyd file.

(please also close Dragon if it is running)).
Traceback (most recent call last):
File "c:\program files (x86)\python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files (x86)\python38-32\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\mrichar2\AppData\Roaming\Python\Python38\Scripts\natlinkconfig_cli.exe_main
.py", line 7, in
File "C:\Users\mrichar2\AppData\Roaming\Python\Python38\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 2030, in main
cli = CLI()
File "C:\Users\mrichar2\AppData\Roaming\Python\Python38\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 1362, in init
self.config.configCheckNatlinkPydFile()
File "C:\Users\mrichar2\AppData\Roaming\Python\Python38\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 281, in configCheckNatlinkPydFile
result = self.copyNatlinkPydPythonVersion(wantedPydPath, targetPydPath)
File "C:\Users\mrichar2\AppData\Roaming\Python\Python38\site-packages\natlinkcore\ConfigureNatlink\natlinkconfigfunctions.py", line 331, in copyNatlinkPydPythonVersion
raise ElevationError("needed for copying the correct natlink.pyd file.")
natlinkcore.ConfigureNatlink.natlinkconfigfunctions.ElevationError: needed for copying the correct natlink.pyd file.

VS2019 or VS2022? ---- natlink.vcxproj issue

So I'm diving into compiling Natlink for Python 3.8 --- nice instructions in NatlinkSource, but I get bumped here:

error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found.

I've double clicked natlink.vcxproj and started the build. In C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\ I only find a file fxcop.xmlandMicrosoft.CodeAnalysis.props, not Microsoft.Cpp.Default.props' ....

Did I miss something when installing the Community version of VS2019 ?? Also, the readme.md refers to both 2019 and 2022 versions of VS!

Use registry to find Dragon NaturallySpeaking paths

DRAGON_DEFAULT_PATHS = {

This is a function I created for caster. It uses the Windows registry to find where Dragon is installed. It's been battle tested over the number of years. Perhaps it could be realized here slightly tweak.

Based on the version number retrieved "C:/ProgramData/Nuance/NaturallySpeaking15" could be extrapolated according to its version number. An alternative approach would be to look for Nuance directory in ProgramData grab the directory.

import os
from pathlib import Path
import winreg

def _find_natspeak():
    '''
    Finds engine 'natspeak.exe' path and verifies supported DNS versions via Windows Registry.
    '''
    print("Searching Windows Registry For DNS...")
    proc_arch = os.environ['PROCESSOR_ARCHITECTURE'].lower()
    try:
        proc_arch64 = os.environ['PROCESSOR_ARCHITEW6432'].lower()
    except KeyError:
        proc_arch64 = False

    if proc_arch == 'x86' and not proc_arch64:
        arch_keys = {0}
    elif proc_arch == 'x86' or proc_arch == 'amd64':
        arch_keys = {winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY}
    else:
        raise Exception("Unhandled arch: %s" % proc_arch)

    for arch_key in arch_keys:
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
                             "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
                             0, winreg.KEY_READ | arch_key)
        for i in range(0, winreg.QueryInfoKey(key)[0]):
            skey_name = winreg.EnumKey(key, i)
            skey = winreg.OpenKey(key, skey_name)
            DisplayName, Publisher, DisplayVersion, InstallLocation = 'null'
            try:
                DisplayName = winreg.QueryValueEx(skey, 'DisplayName')[0]
                Publisher = winreg.QueryValueEx(skey, 'Publisher')[0]
                DisplayVersion = winreg.QueryValueEx(skey, 'DisplayVersion')[0]
                InstallLocation = winreg.QueryValueEx(skey, 'InstallLocation')[0]
            except OSError as error:
                if error.errno == 2:  # Suppresses '[Error 2] The system cannot find the file specified'
                    pass
                else:
                    print(error)
            finally:
                skey.Close()
                if Publisher == "Nuance Communications Inc." and "Dragon" in DisplayName:
                    DnsVersion = int(str(DisplayVersion)[:2])
                    if DnsVersion >= 13:
                        engine_path = str(Path(InstallLocation).joinpath("Program/natspeak.exe"))
                        if os.path.isfile(engine_path):
                            print("Search Complete.")
                            return engine_path
                    else:
                        print(
                            "Dragon Naturally Speaking {} is not supported. Only versions 13 and above are supported. Purchase Dragon Naturally Speaking 13 or above"
                            .format(DnsVersion))
    print("Cannot find dragon engine path")
    return None
print(_find_natspeak())

Natlink also recognising a python version that is not installed for all users

When installing python, you have the choice "install for all users" or "install for current user". These are two different cases for the place where Python does its registry settings.

all users: HKLM (HiveKeyLocalMachine)

only you: HKCU (HiveKeyCurrentUser).

When registering Natlink (natlink.pyd), a registry setting is made in the appropriate python area, but up to now only for the all users case.

The config program already tries to distinguish the two cases (this is done in getRegistryPythonPathDict in natlinkstatus.py (around line 520). This is however not fully tested.

Question for the natlink.pyd developers, to build this also in the C++ code where the path for natlinkmain.py is collected.

RegSvr32 failed with exit code 0x3 error when Installing natlinkv5.0.0.pre

On a fresh install of windows and python 3.8.x 32bit. The installer looks like it is using elevated privileges. I also tried run as admin and installing natlink outside of C:\Program Files (x86) to C:\. This has happened with 2 other individuals.

image

The following suggests it is caused by insufficient Windows User Account permissions.
https://support.lumion.com/hc/en-us/articles/360046361653-How-do-you-fix-a-RegSvr32-failed-with-exit-code-0x3-error-when-Installing-Lumion-#:~:text=Unable%20to%20register%20the%20DLL%2FOCX%3ARegSvr32%20failed%20with%20exit,Lumion%20installer%20but%20by%20something%20on%20your%20PC.

Install Instrution Issues Windows 10

From #48

A user might not remember to put the PATH to the python scripts directory on installl. especially if they use a distriubtion other than the default.

Also, it looks like PIP might have worked on a 64 bit install - natlink should fail to install on a 64 bit python install. the other packages like unimacro should be fine on any size architecture.

Registration Enhancement - COM Registration could tweak dragon ini files

there is configuration done in natlinkconfig_cli that tweaks dragon naturually speaking ini files. The CLSID for natlink is added into one of those ini files, and that is how dragon knows to launch natlink through cocreateinstance (create the natlink object).

I think this would be one in DllInstall in natlinkc.pp.

pywin32 clamped to 300

pywin32 is now at release 301. I think it was one of the natlinkconfig programs that gave me an error or warning in a dialog box that i had no interest in troubleshooting, so i set the specific release of pywin32 in pyproject.toml to 300.

we do need a later release than 300 as i think there are some things in unimacro depending on it.

help needed for module RegistryDict.py

The Natlink configure program needs to do a few things in the registry. The module RegistryDict.py could handle this, and for the simple case of one new key in one place it still works. When adding more subkeys to one key, the script fails.

In order to be more versatile, I would like this module to be ported to python3 with essential changes:
-change win32api to winreg (this is fairly trivial)
-change subclassing object or dict (which is not clear) to collections.UserDict
-make additions of a dictionary into a key/subkey possible.

The current code is in the natlink core directory, and some efforts are already made (RegistryDictUserDictWinreg.py).

A start for a unittest program has been made in the PyTest directory of Natlink.

Hope somebody can help here. I get stuck with understanding all the special __ functions.

natlinkcore site package should be added to python path

In order for dragonfly to import natlink when running the Run_Caster_DNS.bat script it needs to be directly accessible. I think this can be done by putting it on the python path using a module.pth file in the natlink python module.

https://docs.python.org/3/library/site.html

Without the module on the path it fails with this:

C:\voice\caster>Run_Caster_DNS.bat
Running DNS/DPI from Dragonfly CLI with Natlink.
WARNING:engine.natlink:Requested engine 'natlink' is not available: Natlink is not installed: No module named 'natlink' ERROR:command:Requested engine 'natlink' not available.
Press any key to continue . . .

The path can also manually be modified by setting the PYTHONPATH variable:

set PYTHONPATH=C:\Python\Python38-32\Lib\site-packages\natlinkcore

Error with python3-32 on master when running start_configurenatlink.py

File "C:\code\natlink\MacroSystem\core\utilsqh.py", line 124

Traceback (most recent call last):
  File "C:\code\natlink\confignatlinkvocolaunimacro\start_configurenatlink.py", line 61, in <module>
    import natlinkconfigfunctions
  File "C:\code\natlink\confignatlinkvocolaunimacro\natlinkconfigfunctions.py", line 187, in <module>
    import natlinkstatus, natlinkcorefunctions, RegistryDict
  File "C:\code\natlink\MacroSystem\core\natlinkstatus.py", line 191, in <module>
    import natlinkcorefunctions
  File "C:\code\natlink\MacroSystem\core\natlinkcorefunctions.py", line 38, in <module>
    from inivars import IniVars
  File "C:\code\natlink\MacroSystem\core\inivars.py", line 11, in <module>
    import utilsqh
  File "C:\code\natlink\MacroSystem\core\utilsqh.py", line 124
SyntaxError: Non-ASCII character '\xc3' in file C:\code\natlink\MacroSystem\core\utilsqh.py on line 125, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Also if I try enabling unicode support in utilsqh.py then I get:

Traceback (most recent call last):
  File "C:\code\natlink\confignatlinkvocolaunimacro\start_configurenatlink.py", line 61, in <module>
    import natlinkconfigfunctions
  File "C:\code\natlink\confignatlinkvocolaunimacro\natlinkconfigfunctions.py", line 187, in <module>
    import natlinkstatus, natlinkcorefunctions, RegistryDict
  File "C:\code\natlink\MacroSystem\core\natlinkstatus.py", line 273, in <module>
    class NatlinkStatus:
  File "C:\code\natlink\MacroSystem\core\natlinkstatus.py", line 301, in NatlinkStatus
    userregnl = natlinkcorefunctions.NatlinkstatusInifileSection()
  File "C:\code\natlink\MacroSystem\core\natlinkcorefunctions.py", line 531, in __init__
    InifileSection.__init__(self, section=defaultSection, filename=filename)
  File "C:\code\natlink\MacroSystem\core\natlinkcorefunctions.py", line 442, in __init__
    self.ini = IniVars(filename) # want strings to be returned
  File "C:\code\natlink\MacroSystem\core\inivars.py", line 613, in __init__
    readFunc(file)
  File "C:\code\natlink\MacroSystem\core\inivars.py", line 807, in _readIni
    if sectionName in self:
  File "C:\code\natlink\MacroSystem\core\inivars.py", line 629, in __contains__
    raise TypeError('inivars, __contains__ of IniVars expects str for key "%s", not: %s'% (key, type(key)))
TypeError: inivars, __contains__ of IniVars expects str for key "usersettings", not: <type 'unicode'>

Document Natlink compiling instructions

The project has been stalled a number of times due to difficulties compiling Natlink and it is frequently asked question for those of which to contribute. Having some documentation thoroughly documenting the compiling would be to the benefit of the project.

Cannot attach python debugger

It is super hard to make progress on unimacro and vocola without being able to attache a python debugger. I tried pydebug and visual studio code.

This python code didn't work when called (i embedded in a unimacro grammar), attempting to to the port with visual studio code.
debugpy.listen(port)

here is the launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: Attach using Process Id", "type": "python", "request": "attach", "processId": "${command:pickProcess}" }, { "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 9000 } ] }

I also tried with the above remote attach the following command line, python -m debugpy --listen 9000 --pid 14176 --wait-for-client --logo-to debugpy.log where 14176 was natspeak.exe process id at the time.

Mostly i just get an error like "connect ECONNREFUSED 127.0.0.1:9000" in visual studio.

I also tried the "Python: Attach using Process Id" method. That also didnt' work. i tried all the above with firewall and defender antivirus disabled.

There should be a simple way to attach a python debugger, whether it is pydebug, or some instructions on how to run python separately from natspeak.exe if that is even possible.

early warning when natlink installer detects a 64 bit python version

The supported python versions are (now) limited to 37-32 and 38-32. This can change, but especially if a 64 bit python version is running the config program (37-64 or 38-64), an unclear warning is given by the config program.

It should be already in the start_natlinkconfigfunctions.py and start_natlinkconfig.py, but it was reported that this messages was not caught.

code cleanup - redefinition of UNICODE

natlinksource has preprocessor definition of UNICODE that is required, and seems to conflict with visual studio.

natlink is never going back to a non-unicode compile. the preprocesser defiintion of UNICODE should be removed out of visual studio and the conditional compiled code not required removed from natlinksource.

Run-Time Check Failure #2 - Stack around the variable 'node' was corrupted.

I recently upgraded my natlink and its dependencies, and now whenever I issue a command with caster, I get this messagebox:

---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Error!

Program: C:\Python38-32\Lib\site-packages\natlinkcore\natlink.pyd
Module: C:\Python38-32\Lib\site-packages\natlinkcore\natlink.pyd
File: 

Run-Time Check Failure #2 - Stack around the variable 'node' was corrupted.

(Press Retry to debug the application)

---------------------------
Abort   Retry   Ignore   
---------------------------

I tried downgrading natlink (but not its dependencies), and the behavior continues. I tried 0.0.0.1.9-0.0.0.1.2, with the exception of 0.0.0.1.3.

As to the versions of natlink's dependencies:

C:\WINDOWS\system32>pip install --no-cache --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple natlink
Looking in indexes: https://test.pypi.org/simple/, https://pypi.org/simple
Requirement already satisfied: natlink in c:\python38-32\lib\site-packages (0.0.0.1.9)
Requirement already satisfied: wxpython==4.0.7 in c:\python38-32\lib\site-packages (from natlink) (4.0.7)
Requirement already satisfied: pywin32>=300 in c:\python38-32\lib\site-packages (from natlink) (301)
Requirement already satisfied: debugpy in c:\python38-32\lib\site-packages (from natlink) (1.3.0)
Requirement already satisfied: pillow in c:\python38-32\lib\site-packages (from wxpython==4.0.7->natlink) (8.3.1)
Requirement already satisfied: numpy in c:\python38-32\lib\site-packages (from wxpython==4.0.7->natlink) (1.21.1)
Requirement already satisfied: six in c:\python38-32\lib\site-packages (from wxpython==4.0.7->natlink) (1.16.0)

My setup had been working beforehand, with the exception of some occasional glitches which I'd hoped an upgrade would alleviate. I'm using Dragon Professional Individual 15.

Double loading grammars

When I start Dragon, the grammar files are loaded correctly. When I activate the microphone (with wake up or npadd) the grammars files are reloaded.

I saved the log for this. https://pastebin.com/MZ5gNmn2
On lines 26-30 you can see that when Natlink starts _main and _xmlrpc-nb-server are loaded. From line 87 you can see that I have activated the microphone and that the two files are reloaded, although they have not been changed.

German Windows 10
Dragon 15.3 with german Profil
Python 3.8

Building natlink requires project editing for a successful build.

currently, the path to the Python include and library files must be edited by the user in the Visual Studio C++ project for a successful build.

It would be preferable the Python include file directory set outside of the natlink project, either in the user's own solution file, and environment variable, config file etc.. I do not know how to do this in Visual Studio 2019. One would think it would be simple.

acknowledge ~ and env variables in directories of natlink.ini (natlink-light)

I would like that instead of

UserDirectory = C:\Users\Gebruiker.natlink\UserDirectory

also:

UserDirectory = ~.natlink\UserDirectory or

UserDirectory = %(PERSONALHOME).natlink\UserDirectory (either case sensitive or not, I don't know)

would be recognised. This latter one would solve the problem for more computers, with .natlink directory tied to a onedrive directory, as Doug was asking for.

Also check the directory for validity/existence before loading them, in order to make a better error message, than is now presented:

NatLink: an exception occurred in 'natlink.run_loader'.
Python exception: [WinError 3] The system cannot find the path specified: '~\.natlink\UserDirectory'

traceback in natlnk startup Natlink version: 5.1.0


Config Natlink> quit()
PS C:\WINDOWS\system32> pip list
Package Version


certifi 2021.5.30
charset-normalizer 2.0.3
debugpy 1.4.1
docutils 0.17.1
dtactions 1.3.2
et-xmlfile 1.1.0
flit 3.2.0
flit-core 3.2.0
idna 3.2
natlink 5.1.0
nbin-golf 0.0.0.6
numpy 1.21.1
openpyxl 3.0.7
pandas 1.3.1
Pillow 8.3.1
pip 21.1.1
pydebugstring 0.0.0.2
pyenvutils 1.0.0.1
python-dateutil 2.8.2
pytz 2021.1
pywin32 300
requests 2.26.0
setuptools 56.0.0
six 1.16.0
toml 0.10.2
unimacro 0.0.3.10
urllib3 1.26.6
vocola2 0.1.0.5
wxPython 4.0.7

For diagnosing natlink startup issues use DebugView from sysinternals.
path:
checkSysPath with PythonPath setting in registry not needed any more
VocolaDirectory: c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\vocola2
Instructions for attaching a python debugger are in C:\Users\dougr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\natlinkcore\debugging python instructions.docx

checkSysPath with PythonPath setting in registry not needed any more
VocolaDirectory: c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\vocola2
Instructions for attaching a python debugger are in C:\Users\dougr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\natlinkcore\debugging python instructions.docx

-- natlinkmain starting...
Vocola is disabled
Unimacro is disabled
setUserInfo, setting language to: enx
no path given for AhkUserDir: ""
Error loading _sample1 from C:\Users\dougr\OneDrive\doug\dication_toolbox\p3voice\nl_sample1.py
Traceback (most recent call last):
File "c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\natlinkmain.py", line 384, in loadFile
imp.load_module(modName,fndFile,fndName,fndDesc)
File "C:\Users\dougr\AppData\Local\Programs\Python\Python38-32\Lib\imp.py", line 234, in load_module
return load_source(name, filename, file)
File "C:\Users\dougr\AppData\Local\Programs\Python\Python38-32\Lib\imp.py", line 171, in load_source
module = _load(spec)
File "", line 702, in _load
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "C:\Users\dougr\OneDrive\doug\dication_toolbox\p3voice\nl_sample1.py", line 24, in
from natlinkutils import *
File "c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore\natlinkutils.py", line 88, in
from dtactions.sendkeys import sendkeys
File "c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\dtactions\sendkeys.py", line 23, in
from dragonfly.actions import action_key
ModuleNotFoundError: No module named 'dragonfly'
-- skip unchanged wrong grammar file: C:\Users\dougr\OneDrive\doug\dication_toolbox\p3voice\nl_sample1.py
natlinkmain started from c:\users\dougr\appdata\local\programs\python\python38-32\lib\site-packages\natlinkcore:
Natlink version: 5.1.0
DNS version: 15
Python version: 38
Windows Version: 10
User defined macro's enabled, UserDirectory:
C:\Users\dougr\OneDrive\doug\dication_toolbox\p3voice\nl

Where can I find the installer?

For the life of me I can't seem to find any up to date installer of Natlink - the README references one but doesn't link to it - as does the natlink website. The only installer I could find was version 4.1 from 2018 – can someone help me out? Thanks!

Install instructions not working on Windows 10, python 3.8

Following the instructions here: https://github.com/dictation-toolbox/natlink

  1. Upgrade pip immediately:

pip install --upgrade pip`
2. Install natlink, Unimacro, and Vocola2 from Test Python Packaging Index. The following command will do that.
It will also pull any prequisites from the Python Packaging Index.

pip install --no-cache --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple natlink unimacro vocola2
This will install the packages in your Python site-packages area. It will also add the following commands, which should be in your path now in your commmand prompt:

natlinkconfigfunctions
natlinkstatus
startnatlinkconfig
3. Run startnatlinkconfig to configure Natlink.

I'm stuck on step 3; the startnatlinkconfig command is not available.

Any ideas on how to fix this?

Thank you!

dragonfly-commands on  master via 🐍 v3.8.8
❯ python --version
Python 3.8.8

dragonfly-commands on  master via 🐍 v3.8.8
❯ pip install --upgrade pip`
ERROR: Invalid requirement: 'pip`'

dragonfly-commands on  master via 🐍 v3.8.8
❯ pip install --upgrade pip
Requirement already satisfied: pip in c:\tools\miniconda3\lib\site-packages (21.0.1)
Collecting pip
  Downloading pip-21.1.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 2.2 MB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.0.1
    Uninstalling pip-21.0.1:
      Successfully uninstalled pip-21.0.1
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\jaan\\AppData\\Local\\Temp\\pip-uninstall-tkfu6uae\\pip.exe'
Consider using the `--user` option or check the permissions.


dragonfly-commands on  master via 🐍 v3.8.8 took 10s
❯ pip install --no-cache --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple natlink unimacro vocola2

Looking in indexes: https://test.pypi.org/simple/, https://pypi.org/simple
Collecting natlink
  Downloading https://test-files.pythonhosted.org/packages/ff/11/4fbb83d84f563ced915a2a30d5d1017aa570f1682baee83684b0d6d724c3/natlink-0.0.0.1.8.tar.gz (2.1 MB)
     |████████████████████████████████| 2.1 MB 2.2 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting unimacro
  Downloading https://test-files.pythonhosted.org/packages/b5/03/875591b3e09e590f339b534b6fc2fb8ea58d85bb373216c400a581d2a2de/unimacro-0.0.3.8.tar.gz (10.2 MB)
     |████████████████████████████████| 10.2 MB 1.7 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting vocola2
  Downloading https://test-files.pythonhosted.org/packages/cd/74/fca38a6561ca6ae49b6d8f41fc1195dd9db4d5ae407c202b8adc043dd204/vocola2-0.1.0.5.tar.gz (743 kB)
     |████████████████████████████████| 743 kB 2.2 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting wxpython==4.0.7
  Downloading wxPython-4.0.7-cp38-cp38-win_amd64.whl (22.9 MB)
     |████████████████████████████████| 22.9 MB 1.3 MB/s
Collecting pywin32>=300
  Downloading pywin32-300-cp38-cp38-win_amd64.whl (9.3 MB)
     |████████████████████████████████| 9.3 MB 1.6 MB/s
Collecting debugpy
  Downloading debugpy-1.3.0-cp38-cp38-win_amd64.whl (4.4 MB)
     |████████████████████████████████| 4.4 MB 3.2 MB/s
Requirement already satisfied: pillow in c:\tools\miniconda3\lib\site-packages (from wxpython==4.0.7->natlink) (8.2.0)
Requirement already satisfied: numpy in c:\tools\miniconda3\lib\site-packages (from wxpython==4.0.7->natlink) (1.20.1)
Requirement already satisfied: six in c:\tools\miniconda3\lib\site-packages (from wxpython==4.0.7->natlink) (1.15.0)
Building wheels for collected packages: natlink, unimacro, vocola2
  Building wheel for natlink (PEP 517) ... done
  Created wheel for natlink: filename=natlink-0.0.0.1.8-py3-none-any.whl size=1959000 sha256=e60681521b8148a4f70b7b71e8c6ba02532075224e4d5d9f21e4698880d2d174
  Stored in directory: C:\Users\jaan\AppData\Local\Temp\pip-ephem-wheel-cache-uq_5mq37\wheels\24\47\a7\a1861842b0d7b063cffc4d8ceab7b457b3ce01aa1a2c8bdcef
  Building wheel for unimacro (PEP 517) ... done
  Created wheel for unimacro: filename=unimacro-0.0.3.8-py3-none-any.whl size=662716 sha256=287d4a704fcc58764fedc5ca79ebcbbd8325a38e4f9b4a570470ef7d592c661d
  Stored in directory: C:\Users\jaan\AppData\Local\Temp\pip-ephem-wheel-cache-uq_5mq37\wheels\3a\b0\a8\91d7a2761371f6cdbb0e778b88aff74769ddbfd70888df31e2
  Building wheel for vocola2 (PEP 517) ... done
  Created wheel for vocola2: filename=vocola2-0.1.0.5-py3-none-any.whl size=764729 sha256=5ad5b43bf79b9733b780a081947869fb4129d9a040bab2061fb51570f6ccee7c
  Stored in directory: C:\Users\jaan\AppData\Local\Temp\pip-ephem-wheel-cache-uq_5mq37\wheels\de\20\76\5382da8a3b6a61386f21db015a706ffa72c00ab307abdf5ce5
Successfully built natlink unimacro vocola2
Installing collected packages: wxpython, pywin32, debugpy, natlink, unimacro, vocola2
  Attempting uninstall: pywin32
    Found existing installation: pywin32 227
    Uninstalling pywin32-227:
      Successfully uninstalled pywin32-227
Successfully installed debugpy-1.3.0 natlink-0.0.0.1.8 pywin32-300 unimacro-0.0.3.8 vocola2-0.1.0.5 wxpython-4.0.7

dragonfly-commands on  master via 🐍 v3.8.8 took 1m3s
❯ startnatlinkconfig
startnatlinkconfig: The term 'startnatlinkconfig' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

There is also a small typo in the install command for upgrading pip, an additional backtick "`" at the end: in pip install --upgrade pip`

PySide2 5.15.2.1: ImportError: DLL load failed while importing shiboken2: The specified module could not be found.

This error occurred in python 3.10.2 and 3.8.9 32-bit. Simply load '_test.py' with a the import from PySide2 import QtCore to reproduce.
The only happens with Natlink and not other engines or dragonfly text engine.

shiboken2 does exist in: "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\Lib\site-packages\shiboken2\shiboken2.pyd"

Natlink Version: 5.0.0
Python Version: 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 13:59:55) [MSC v.1929 32 bit (Intel)]
NatLink: LOADED!
PySide2/__init__.py: Unable to import shiboken2 from C:\Users\MainLaptop\Documents\Caster, C:\Program Files (x86)\Natlink\site-packages\natlink\python310.zip, C:\Program Files (x86)\Natlink\site-packages, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\Lib, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\DLLs, C:\Program Files (x86)\Nuance\NaturallySpeaking13\Program, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\win32, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\win32\lib, C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\Pythonwin
Traceback (most recent call last):
  File "C:\Program Files (x86)\Natlink\site-packages\natlink\loader.py", line 138, in load_or_reload_module
    module = self._import_module_from_path(mod_path)
  File "C:\Program Files (x86)\Natlink\site-packages\natlink\loader.py", line 111, in _import_module_from_path
    loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\MainLaptop\Documents\Caster\_p.py", line 1, in <module>
    from PySide2 import QtCore
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\PySide2\__init__.py", line 107, in <module>
    _setupQtDirectories()
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\PySide2\__init__.py", line 58, in _setupQtDirectories
    import shiboken2
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\shiboken2\__init__.py", line 27, in <module>
    from .shiboken2 import *
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Natlink\site-packages\natlink\loader.py", line 138, in load_or_reload_module
    module = self._import_module_from_path(mod_path)
  File "C:\Program Files (x86)\Natlink\site-packages\natlink\loader.py", line 111, in _import_module_from_path
    loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\MainLaptop\Documents\Caster\_p.py", line 1, in <module>
    from PySide2 import QtCore
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\PySide2\__init__.py", line 107, in <module>
    _setupQtDirectories()
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\PySide2\__init__.py", line 58, in _setupQtDirectories
    import shiboken2
  File "C:\Users\MainLaptop\AppData\Local\Programs\Python\Python310-32\lib\site-packages\shiboken2\__init__.py", line 27, in <module>
    from .shiboken2 import *
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.
Attempting to load duplicate module: C:\Users\MainLaptop\Documents\_test.py)

Adding shiboken2.pyd to path sys.path.append leads to no change.

code cleanup - depends in natlink

the pyproject.toml currently includes dragonfly. probably that dependency should be removed. whoever fixes the code remember to fix the pyproject.toml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.