ppannuto / python-saleae

Python library to control a Saleae Logic Analyzer
Apache License 2.0
124 stars 55 forks source link

export_analyzer returns before csv file is completed #51

Closed kubaraczkowski closed 4 years ago

kubaraczkowski commented 5 years ago

Hi,

I'm seeing an erratic behavior when running loops around the export_analyzer functionality. As far as I see the function returns before the CSV file is complete - this means that subsequent reads of the csv return less data than intended.

Is that something on the python-wrapper level though, or a trouble with the C++ API? Or - obviously - am I doing sth wrong?

ppannuto commented 4 years ago

Sorry! I somehow missed this. In the Saleae documentation (which is largely copied over into the docstrings) they note:

Export analyzer index N and save to absolute path savepath. The analyzer must be finished processing (emphasis mine)_

Are you doing anything to check that it's complete (i.e. calling is_analyzer_complete) first?

kubaraczkowski commented 4 years ago

Gosh, it has been a while now, we actually had to move to Digilent's system to avoid hitting this issue.

The problem was indeed that the analyzer is finished (is_analyzer_complete() is true) but the exported CSV is not closed or flushed. This results in a reading error when trying to load that CSV...

On Thu, 20 Feb 2020 at 01:17, Pat Pannuto notifications@github.com wrote:

Sorry! I somehow missed this. In the Saleae documentation (which is largely copied over into the docstrings) they note:

Export analyzer index N and save to absolute path save_path. The analyzer must be finished processing (emphasis mine)

Are you doing anything to check that it's complete (i.e. calling is_analyzer_complete) first?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ppannuto/python-saleae/issues/51?email_source=notifications&email_token=AAEHNHHHRCNJOI6DHREAO7DRDXDZTA5CNFSM4HLPXAH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMKHJFA#issuecomment-588543124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEHNHCGDSMM7LC73IXTXULRDXDZTANCNFSM4HLPXAHQ .

ppannuto commented 4 years ago

Sorry to hear that. I'm guessing from the sounds of it this was a larger file. I think the export_analyzer method just triggers the write to start, but doesn't have any way to report whether the write was complete. I'm guessing a small sleep afterwords would have worked, but been a bit dissatisfying.

I'll ping @Marcus10110 in case this is something Saleae is interested in knowing about / has a solution, but I'll probably also close this issue here as I don't think there's anything the Python wrapper can do. Feel free to re-open (anyone) if there's something more that this library can do here.