The code in your first message makes me think that you are trying to
run the Python file as a "script" as opposed to a "macro" loaded by
natlink running inside DNS. That is possible, although you need to
take care of some additional processing yourself instead of letting
natlink do it for you. For example, you must run your own "message
loop" to drive the script.
An example of an application that loads Dragonfly command modules
itself, i.e. in a standalone application instead of in the natlink
that is running inside of DNS, is Bumblebee. Source code available
here:
https://bitbucket.org/t4ngo/bumblebee
Specifically note the following code within Bumblebee:
- bumblebee/system/dragonfly.py: DragonflySystemParticipant.startup()
and .shutdown() -- these connect and disconnect from a speech
recognition engine
- bumblebee/command/legacy_loader.py: LegacyDirectoryLoader.update()
-- command modules are loaded and unloaded here
Kind regards,
Charlie
Have you had any success with this? What do you think of the Bumblebee code?
The challenge you're facing here is due to DNS's architecture (and
Windows in general). When you connect to the recognition engine, and
it sends you a recognition event, you must run some kind of an event
loop, otherwise the recognition engine will block waiting for you.
That's just the way Windows applications talk to each other. Writing
such an event loop can be slightly tedious, so I hope that Bumblebee
can serve as an example to help you dare.
Best regards,
Charlie