SDK and Python 3, errors and improvements 2

  • solarjoe
  • Topic Author
More
15 Jan 2015 05:23 #2927 by solarjoe
Hello Paul,

I downloaded the new release of the SDK but the Python files did not change since the release
mid of December. Only the file ssc.pyc was added.

I attached my script to this new thread because I could not attach it to the other one.
There was a brower error message:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /file/ajax/upload/und/form-DuZKA4pRL0p8w4i30-DUNxKR8csYRsLETV7LQhq576w
StatusText: n/a
ResponseText: The specified URL cannot be found.
ReadyState: undefined

About the Python script, the UTF-8 error is related to the function info_label().

return t.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x91 in position 19: invalid start byte

You can also check the other changes to convert from Python 2 to 3, maybe you have better
ideas.

Kind regards,
Joe

Please Log in or Create an account to join the conversation.

  • solarjoe
  • Topic Author
More
10 Feb 2015 01:19 #2928 by solarjoe
Replied by solarjoe on topic SDK and Python 3, errors and improvements 2
Hello Paul,

any news on what might cause the UnicodeDecodeError in Python 3?

Kind regards,
Joe

Please Log in or Create an account to join the conversation.

  • pgilman
More
10 Feb 2015 10:37 #2929 by pgilman
Replied by pgilman on topic SDK and Python 3, errors and improvements 2
Sorry for the delay, Joe. Thank you for posting your Python example. We're investigating the unicode issue now. I just posted an update to the SDK for SAM 2015.1.30.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • pgilman
More
17 Feb 2015 16:37 #2930 by pgilman
Replied by pgilman on topic SDK and Python 3, errors and improvements 2
Hi Joe,
We've finally tracked down the cause of the unicode error and have a fix. The error is caused by C++ code in the SSC module for the HCPV module that uses a single quote in one of the output variable labels. The solution for the Python wrapper is to modify the definition of
Code:
info_label()
in sscapi.py.
Old:
Code:
def info_label( self, p_inf ): 


     self.pdll.ssc_info_label.restype = c_char_p

     return self.pdll.ssc_info_label( c_void_p(p_inf) )
New:
Code:
def info_label( self, p_inf ):<br /> &nbsp; &nbsp; &nbsp;self.pdll.ssc_info_label.restype = c_char_p<br /> &nbsp; &nbsp; &nbsp;t = self.pdll.ssc_info_label( c_void_p(p_inf) )<br /> &nbsp; &nbsp; &nbsp;return t.decode('utf-8', 'ignore')

Here is a link to a version of sscapi.py with the correction:
sscapy-3-4-2.py.txt ( PY 104 KB ). You'll have to remove the .txt extension after you download the file.
We will include this file in the next version of the SDK
Best regards

Paul.

Please Log in or Create an account to join the conversation.

  • sjschneider
More
11 Oct 2016 12:47 #2931 by sjschneider
Replied by sjschneider on topic SDK and Python 3, errors and improvements 2
Hello,

I've ported SAM's Python 2 API to Python 3 and set it up as a Python module: py3samsdk . It is compatible with the latest March 14, 2016 release. I've set up some unit tests, but it has not undergone extensive platform testing, etc. Please feel free to use and contribute!

- Stephen

Please Log in or Create an account to join the conversation.

  • solarjoe
  • Topic Author
More
17 Jan 2017 05:50 #2932 by solarjoe
Replied by solarjoe on topic SDK and Python 3, errors and improvements 2
Hello Paul,

will you deploy py3samsdk with the SAM SDK in the future?

Joe

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum