# Export CAN data table with the actual data?

**URL:** <https://discuss.saleae.com/t/export-can-data-table-with-the-actual-data/3063>\
**Category:** Uncategorized\
**Created:** [September 23, 2024, 10:38am UTC](https://discuss.saleae.com/t/export-can-data-table-with-the-actual-data/3063 "2024-09-23T10:38:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![henrikfritzonsund](https://avatars.discourse-cdn.com/v4/letter/h/ecb155/32.png) [@henrikfritzonsund](https://discuss.saleae.com/u/henrikfritzonsund)\
**Post date:** [September 23, 2024, 10:38am UTC](https://discuss.saleae.com/t/export-can-data-table-with-the-actual-data/3063/1 "2024-09-23T10:38:25Z")

</div>

Hello!

I am attempting to automate some CAN based scenario tests.

This code snippet generates a csv without any data present (the data fields are empty):

```auto
        can_analyzer_1 = capture.add_analyzer(
            'CAN',
            label=f'CAN1',
            settings =
            {
                'CAN': 0,
                'Bit Rate (Bits/s)': 125000
            }
        )
        automation.DataTableExportConfiguration(can_analyzer_1, automation.RadixType.HEXADECIMAL)

.
. # Capture data
.
        # Export CAN1 analyzer data to a CSV file
        can1_analyzer_export_filepath = os.path.join(saleae_output_dir, 'can1_data_analyzer_sample.csv')
        capture.export_data_table(
            filepath=can1_analyzer_export_filepath,
            analyzers=[can_analyzer_1],
            iso8601_timestamp=True
        )
        print(f"{can1_analyzer_export_filepath = }")

```

However when doing the export data table feature manually (see: [Exporting Data | Saleae Support](https://support.saleae.com/user-guide/using-logic/exporting-data)) I manage to get the data available in the csv file.

After some investigation I noticed that the manual export produces better/more correct data (also using hex values instead of int).

Any ideas how to make the automatic export produce the same content?

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [September 24, 2024, 12:50am UTC](https://discuss.saleae.com/t/export-can-data-table-with-the-actual-data/3063/2 "2024-09-24T00:50:21Z")

</div>

@henrikfritzonsund A race condition is likely occurring, and I suspect your capture might be long enough such that data is being exported before all data has been processed for decoding. In other words, the data table is likely not yet ready to be exported. This is likely our fault (we should provide a means to block execution until analyzer processing has been completed).

Can you try adding a short delay before exporting your data to see if that helps?

For an example, the user below ran into the same issue and a 250 ms delay before exporting helped.

> [@Export Raw Data CSV sometimes failing](https://discuss.saleae.com/t/export-raw-data-csv-sometimes-failing/2580/10):
>
> I did review several of our test results and the .csv and .sal do differ quite often, but only by about 30ms. I put a 250ms sleep after the stop() and this solved the problem.
