- Posts: 73
SDK and Python 3, errors and improvements 2
- solarjoe
- Topic Author
Less
More
15 Jan 2015 05:23 #2927
by solarjoe
SDK and Python 3, errors and improvements 2 was created 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
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
Less
More
- Posts: 73
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
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
Less
More
- Posts: 5447
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.
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
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
in sscapi.py.
Old:
self.pdll.ssc_info_label.restype = c_char_p
return self.pdll.ssc_info_label( c_void_p(p_inf) )
New:
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.
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()
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 />
self.pdll.ssc_info_label.restype = c_char_p<br />
t = self.pdll.ssc_info_label( c_void_p(p_inf) )<br />
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
Less
More
- Posts: 2
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
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
Less
More
- Posts: 73
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
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