This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
my tool with Python SDK backend and HTML GUI frontend now works fine in any Alteryx Designer. When uploading workflows containing the tool to the Alteryx Server, however, I receive error messages related to the validation of the tool settings.
In particular, I have a field called KeyfilePath which is defined as
In my Python backend, I get and verify the setting using
def pi_init(self, str_xml: str):
setting_tree = Et.fromstring(str_xml)
self.sftp_settings['key_filepath'] = setting_tree.find('KeyfilePath').text
if not os.path.exists(self.sftp_settings['key_filepath']):
self.output_message('The keyfile could not be found. Please check file path.')
As I said, it works fine in any Designer - also when opening the workflow in the Designer on the server. When running the Workflow on the server, however, either through the gallery our through the AlteryxEngineCmd.exe command-line tool, I get errors:
If the KeyfilePath setting is not set, I get an error message that the keyfile could not be found – but this should not be checked anyway.
If the KeyfilePath setting is set, it is not recognized, meaning that at another point in the tool, I receive a message as if the setting is not set.
There seems to be a difference in how tool settings are managed between the GUI and the Command Line / Server Engine. Is there any documentation on how these differences effect custom tools?
Happy to share the tool and a test workflow privately.
PS: Alteryx Designer and Server Version 2019.2.5.62427
Designer and Server differ in how white space from the Configuration XML is preserved or removed. While Designer removes leading and trailing spaces, the Server preserves it. Since the GUI automatically adds new lines and whitespace - even to empty XML tags - in the server the empty setting is not empty.
the front end UISDK ought to wrap your SimpleString values in CDATA so your whitespace will be preserved like that.
this is not the case. BTW it would be nice if we could force the GUI SDK to wrap settings in CDATA tags.
I wrote a small wrapper method to load settings from the GUI:
def _prep_xmltext(et: xml.etree.ElementTree, key: str) -> str:
"""Wrapper to quickly get settings.
:param et: Element Tree from parsed Xml
:type et: xml.etree.ElementTree
:param key: Name of the setting
:type key: str
:return: Parsed value for setting
t = et.find(key).text.strip() if et.findtext(key) and (et.find(key).text is not None) else None
return None if not t or t == "" else t
Maybe a future version of the SDK could include something similar and more robust, that catches more awkward Alteryx behaviors.