Using the Saleae Automation API interactively

Hej hej,

I’m trying to utilize the Saleae Automation API for test system development.
During development, we usually are able to test usage of driver (like the Saleae-wrapper we created) interactively in VS Code using Jupyter cells (and ipykernel)…

When I try this with the script shown in the picture above, which is kind of a wrapper for the Automation API, this does not work properly…
I get a rather cryptic error message, saying “Attaching job to the process object didn’t work…”…

Any idea what is happening here and how to get it to work as expected?

Thanks !

Cheers
Niels Göran

In the screenshot, it is saying:

last error: UNAVAILABLE: ipv4:127.0.0.1:10430: ConnectEx: Connection refused (No connection could be made because the target machine actively refused it

Is the Logic 2 process getting spawned, and is the port/automation setup? Can you run the same Manager.launch() command from a python script outside of the VS Code environment?

Some ideas on Automation launch:

And another thread about launching the GUI from a script:

And finally, one talking specifically about launching from within VS Code:

I noticed some possible fixes:

  • Use the Electron/VS Code work around:
    del os.environ['ELECTRON_RUN_AS_NODE']
  • If using Manager.launch() make sure client is not running before launching (i.e., kill off any existing process first)
  • Use with automation.Manager.launch() as manager: syntax, so the Manager object is not prematurely destroyed
    (client automatically stopped when Manager destroyed)
  • Use Manager.connect() instead of Manager.launch() and make sure client is already running before trying to connect
    (e.g., could use a separate automated method to start Logic 2 process, or just start manually)

Hej hej,

thank again for also answering this one…

The Logic application starts smoothly and the different commands run smoothly…
as long as I run everything via a terminal in VS Code…
The issue only arrises, once choosing the option “Run Current File in interfactive Window”…
That kind of pointed me in the direction, of that… like “what is VS Code actually doing, if you choose that option…”…

Given your ideas as solution:

  1. will try this… seem possible, given that that was also the issue with the unit test, as an indirectly calling method…
  2. Tried this, Logic was never running before trying the scripts… so no luck…
  3. Scripts work normally without interactive Window, so I’m assuming that the references are kept open correctly… But will try your approach as well …
  4. not really an option, given that I want to try to check the correct execution, to kind of replay it later in an atuomated fashion… I could automate starting Logic beforehand, but would prefer to go with on-board-options, rather than doing automated workarounds…

Thanks !

Cheers
Niels Göran