Export Raw Data CSV sometimes failing

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, filepath, name):
        self.capture.export_raw_data_csv(directory=str(filepath), analog_channels=self.analog_channels, digital_channels=self.digital_channels)
        shutil.move(str(filepath)+'/digital.csv',str(filepath)+'/'+name+'.csv')
        self.capture.save_capture(str(filepath)+'/'+name+'.sal')

Heres an example of the saved capture and the output raw csv:
multi.txt (176 Bytes)
multi.sal (3.6 KB)

@cwilliamson It looks like a race condition is occurring in your automation script. Are you calling wait() before exporting your raw data like in the example script below?

https://saleae.github.io/logic2-automation/getting_started.html

Hi Tim, thanks for the response.

It shouldn’t be an issue as I’m running it in manual capture mode and using the stop() function. Whats also strange is the exported sal file is all good. I ran it around 300 times and it only fails about 6 times which isn’t bad but would be nice to figure out what is causing it.

@cwilliamson Hmm… thanks for confirming that. Calling the stop() function should be enough.

It certainly sounds like an edge case since it only fails 6 out of 300 times. I’m now wondering if calling shutil.move right after exporting the raw data might have something to do with that edge case. Is it convenient to remove that the shutil.move command to test that theory out?

Also, would you mind sharing your entire Python script file? If it contains confidential information, we can move this conversation over email via the link below if you prefer.
https://contact.saleae.com/hc/en-us/requests/new