Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Issue running python tool leveraging pysftp package

kevinw73
5 - Atom

Hi Everyone,

 

I have been experiencing with a series of macros I created that are used to list the directory, download and upload files to our sftp that is hosted through Syncplify.  I am currently on designer version 2021.3.4.  These macros have been working great up until 12/27 when time came to run the workflow again for a monthly project we have been testing.  Below is the specific error message I am getting (more text below message):

 

Error: sFTP File Upload (42): Record #1: Tool #1: Traceback (most recent call last):
File "C:\Users\KevinWinstead\AppData\Local\Temp\Engine_17992_9ede2832e7534fb285e473b433bc363a_\17c72d88636d4bc2d05c112abd813d18\workbook.py", line 25, in <module>
srv = pysftp.Connection(host=ftpHostStr, username=ftpUsernameStr,
File "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_venv\lib\site-packages\pysftp\__init__.py", line 143, in __init__
self._transport.connect(**self._tconnect)
File "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_venv\lib\site-packages\paramiko\transport.py", line 1387, in connect
self.auth_publickey(username, pkey)
File "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_venv\lib\site-packages\paramiko\transport.py", line 1634, in auth_publickey
return self.auth_handler.wait_for_response(my_event)
File "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_venv\lib\site-packages\paramiko\auth_handler.py", line 258, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

 

Below is a snapshot of the code inside the tool:

 

kevinw73_0-1643034048505.png

 

I am attaching the code to this thread as a txt.  The code in this workflow works locally when running through spyder.  I have been troubleshooting this with one of our developers that works closer to the Syncplify side and so far cannot detect any changes on their side.  The only changes I can think for me between the last time it worked was updating from 2021.3.1 to 2021.3.4 which I could not see being a difference of any type to cause this sort of issue.  I have also monitored the packets through Fiddler and cannot detect any issues or errors with Alteryx reaching the Syncplify servers. 

 

Thanks in advance for your help and direction as we continue to investigate this issue!  Any advice or direction is appreciated if you have experienced the same.  Thanks!

 

Kevin W 

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

How is the pem_key file being read? Looks like the Text Input just gets updated with the location of the Pem Key File, and not the contents?

kevinw73
5 - Atom

Hi @PhilipMannering 

 

Thanks for the reply!

 

The PEM key is referenced in the macro front end and is a path to the PEM key on the users machine:

 

kevinw73_0-1643045418910.png

 

I am not 100% certain at which point the contents is read but I believe in the connection portion of the script after it is read in and converted to a string var:

 

kevinw73_1-1643045512718.png

 

I will have to step through it again to see the exact location.  Again this exact script works using the same pem references when run through spyder outside of designer and I can call and make directories on the sftp as needed.  

 

Thanks for your help!

 

PhilipMannering
16 - Nebula
16 - Nebula

Maybe add

print(pemKeyStr)

 in the script (in the Alteryx macro).

And in your main workflow you can show the macro messages by ticking this box,

PhilipMannering_0-1643048309560.png

 

This will confirm or deny my suspicion that you're actually passing the file location rather than contents of the file.

 

kevinw73
5 - Atom

Thanks for the reply! 

 

I have that enabled and it prints the file location passed into the variable: 

 

kevinw73_0-1643049781782.png

 

However, I am expecting it to do this because according to the docs for the pysftp package, the path to the key file should be referenced in the "private_key" parm of the connection method which is why I am reading it in from the front end and then copying to a string variable before passing into the connection.  I guess despite this, the part that is baffling me is this was working as is up until ~11/17/21 but has since stopped and the only thing that has changed since last successful run as far as I can tell is my designer version updating from 2021.3.1 to 2021.3.4.  I originally thought the package version may have been updated but the python code works as is when run locally without issue.  

 

Thanks again for your help stepping through this!

Labels