Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"CommandNAKedError" received while exporting data using export_analyzer #47

Closed
pudumula opened this issue Dec 26, 2018 · 1 comment
Closed

Comments

@pudumula
Copy link

While running the following script

import os
import saleae
import time
s = saleae.Saleae()
s.get_analyzers()
s.set_capture_seconds(10)
s.capture_start_and_wait_until_finished()
save_path = os.path.join(os.getcwd(), "file_name.csv")
# 0 is simple parallel
while not s.is_analyzer_complete(0):
    time.sleep(1)
time.sleep(10)
s.export_analyzer(0,save_path)

i get the following error


CommandNAKedError Traceback (most recent call last)
in ()
2 time.sleep(1)
3 time.sleep(10)
----> 4 s.export_analyzer(0,save_path)
5 # s.export_data2(save_path)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\saleae\saleae.py in export_analyzer(self, analyzer_index, save_path, wait_for_processing, data_response)
972 '''Export analyzer index N and save to absolute path save_path. The analyzer must be finished processing'''
973 if wait_for_processing:
--> 974 while not self.is_analyzer_complete(analyzer_index):
975 time.sleep(0.1)
976 self._build('EXPORT_ANALYZER')

~\AppData\Local\Continuum\anaconda3\lib\site-packages\saleae\saleae.py in is_analyzer_complete(self, analyzer_index)
986 self._build('IS_ANALYZER_COMPLETE')
987 self._build(str(analyzer_index))
--> 988 resp = self._finish()
989 return resp.strip().upper() == 'TRUE'
990

~\AppData\Local\Continuum\anaconda3\lib\site-packages\saleae\saleae.py in _finish(self, s)
181 self._build(s)
182 try:
--> 183 ret = self._cmd(', '.join(self._to_send))
184 finally:
185 self._to_send = []

~\AppData\Local\Continuum\anaconda3\lib\site-packages\saleae\saleae.py in _cmd(self, s, wait_for_ack, expect_nak)
214 ret = None
215 if wait_for_ack:
--> 216 ret = self._recv(expect_nak=expect_nak)
217 return ret
218

~\AppData\Local\Continuum\anaconda3\lib\site-packages\saleae\saleae.py in _recv(self, expect_nak)
205 return None
206 else:
--> 207 raise self.CommandNAKedError
208 ret, self._rxbuf = self._rxbuf.split('ACK', 1)
209 return ret

CommandNAKedError:

Is something wrong with my script ?

@ppannuto
Copy link
Owner

Hmm, there seem to be some known issues in the Saleae software where it can NAK unexpectedly if the Saleae software isn't ready (see #7 for more discussion).

You can try adding a sleep before calling is_analyzer_complete. Also, in this case specifically, I don't think you should need to the explicit call as the library will call wait internally anyway.

Since it's just the wait that's throwing, you can also try catching the NAK error and reissuing the is_complete check.

I don't think this is an issue in the python library, but feel free to re-open if you find a bug in the library somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants