Zebra newbie here. I cobbled together three cpp object files from Zebra's console sample to enable, scan, and disable an MS4717 scanner. We want our prototype's computer, an RPi 4B with Ubuntu, to activate the scanner only at specific times - and have the MS4717 deactivated the rest of the time.
Most of our system's software is in Python, and I call the cpp object files (i.e. enable, scan, disable) as subprocesses. Generally speaking everything seems to work, but I get the error below after my script is complete.
"terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 0)"
I can't tell which of the three cpp object files is causing the error. I'd image either reading scans or disabling the scanner, but maybe there's a buffer or variable I should flush before disabling the scanner.
Any recommendations on what to look at?
Thanks.
6 Replies
not familiar with error , commands has status results , whats the error status you getting ?
Thanks for the help. Not sure what you mean by "commands has status results". I included the error I'm getting above, "terminate called after throwing...".
I'm not familiar with the error either (more familiar with Python) and searched online before posting here. Most search results are on websites that have to do with C++, which is what lead believe it might be due to the object files versus Python.
Here are a couple posts I came across:
https://stackoverflow.com/questions/40570702/how-to-fix-terminate-called-after-throwing-an-instance-of-stdout-of-range
https://www.linux.org/threads/terminate-called-after-throwing-an-instance-of-std-out_of_range.42853/
https://en.cppreference.com/w/cpp/error/out_of_range
there is now Zebra sdk library for python so not sure what you are using .
That was not available when I/we started. Did a quick search on Zebra's website, but didn't find the Python SDK library. Can you please send a link where I can learn more?
I meant there is *no python SDK from zebra . Did you write your own wrapper ? U need to clarify what implementation you have done.
I'm not completely familiar with the term "wrapper".
I used the Console sample source code to create and compile three individual C++ object files, that use Zebra's corescanner driver, which our Python script is dependent on. For whatever it's worth, the three object files work independent of Python directly from the command line.
Let me review how the object files are called from Python and specifically, how "disable" manages output and get back to you. The next couple of days are busy, and there may be some testing to do, so I may not get back to you until next week.