# RPC error

**URL:** <https://discuss.saleae.com/t/rpc-error/2864>\
**Category:** Logic 2 Software\
**Created:** [May 7, 2024, 6:36pm UTC](https://discuss.saleae.com/t/rpc-error/2864 "2024-05-07T18:36:43Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![BitBob](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/bitbob/32/2292_2.png) [@BitBob](https://discuss.saleae.com/u/BitBob)\
**Post date:** [May 10, 2024, 6:13pm UTC](https://discuss.saleae.com/t/rpc-error/2864/5 "2024-05-10T18:13:22Z")

</div>

If you want to debug more on your own, you might try using [Wireshark](https://www.wireshark.org/) to capture the network traffic. The Automation API uses [gRPC](https://grpc.io/) as the [underlying logic2-automation protocol](https://github.com/saleae/logic2-automation/tree/develop/proto/saleae/grpc) and there are [methods to analyze gRPC messages within Wireshark](https://grpc.io/blog/wireshark/) itself.

Just looking at the error message you showed above:

> [@nick.smith](#):
>
> debug\_error\_string = “UNKNOWN:failed to connect to all addresses; last error: UNAVAILABLE: ipv4:127.0.0.1:10430: WSA Error {grpc\_status:14, created\_time:“2024-05-03T16:14:13.794837763+00:00”}”

It seems like the gRPC server connection was intermittently failing:

```auto
ipv4:127.0.0.1:10430

```

… according to the **status code 14** ( **UNAVAILABLE** ), [per the gRPC documentation](https://grpc.github.io/grpc/core/md_doc_statuscodes.html):

> The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.

Are you starting & running `Logic.exe` locally as a standard process natively on Windows 10 desktop/laptop console, or are doing something more elaborate (e.g., using a virtual machine or container, running remotely, etc.)?

Finally, if the issue is more like a race condition internal to the Saleae Logic 2 software itself vs. some type of local networking issue on the PC, you might be able to work around it by adding some delays between automation API calls: like inserting a `time.sleep()` call before each `capture.`_command_ in your script?

Note: the line numbers in the quoted error message don’t appear to line up exactly with the attached `saleae_test.py` script (as the attached file was **only 58 lines** ):

> [@nick.smith](#):
>
> Traceback (most recent call last):  
> File “test\_saleae1.py”, line 73, in  
> test\_the\_saleae()  
> File “test\_saleae1.py”, line 44, in test\_the\_saleae  
> capture.save\_capture(filepath=capture\_filepath)

However, the traceback suggests it _might_ be something between the `capture.export_raw_data_csv()` and `capture.save_capture()` API calls? If so, perhaps the ‘export csv’ didn’t completely finish and the gRPC server is still busy when the ‘save capture’ is called – so you could try adding a `time.sleep()` of a few seconds in between those calls first?

One last clue – there was another post about exporting raw data CSV sometimes failing, which might be related to your issue:

> [@Export Raw Data CSV sometimes failing](https://discuss.saleae.com/t/export-raw-data-csv-sometimes-failing/2580):
>
> Hi, I’ve noticed with “export\_raw\_data\_csv” function sometimes the data is cut off when there are four channels of data being exported. Strangely enough the capture file gets saved correctly but the csv doesn’t match. I can open the capture and re export it and everything gets exported as expected. Unfortunately this solution doesn’t work when trying to automate testing. I’ve only noticed this with multiple channels. Here’s the code I’m using to export the data: def save\_capture(self, fi…

[Edit:]  
Looks like Saleae has an example for automating long captures that is similar to your code, in their technical FAQ:

> **[Automating Long Overnight Captures | Saleae Support](https://support.saleae.com/faq/technical-faq/automate-long-captures)**

… where they suggest using python threading to reduce latency in between captures. This technique might help, especially if you need to insert a delay between saving the raw CSV and the capture file.

Alternatively, you could temporarily omit saving the raw CSV file and see if saving the capture file only resolves the problem? If so, you can always export the CSV file from the capture files (\*.sal) later, rather than exporting it while collecting the data in the first place. For example, you could create a separate script that would use the [automation API `load_capture()` method](https://saleae.github.io/logic2-automation/automation.html#saleae.automation.Manager.load_capture) and export raw data CSV from there?

---

_[View the full topic](https://discuss.saleae.com/t/rpc-error/2864)._
