Free Trial

Alteryx Designer Desktop Discussions

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

Python tool in Alteryx server - Object Reference not set to an instance of an object" erro

AIPH123
8 - Asteroid

Hi All,

 

I am trying to access data from SFTP and I have written a code in python tool and it works perfectly from alteryx designer. When I try to push it to server, I get the error "  Object reference not set to an instance of an object" Then I realised I am reading my private key from local machine and so I pushed it to online and used the link to read the data. But still i get the same error. 

 

I suspect the error could be due to pandas as I am getting the file from SFTP and using pandas to convert into data frame locally and this could be the reason for the error. Is there anyway I can get rid of this error? Please advise.

 

Below is the code for your reference.

 

Thank you.

 

 

 

 

 

 

import pysftp
import re
sftphost='xxxxxxx'
sftpport=22
uname='xxxxx'
privatekeyfilepath=r'xxxx'
cnOpts=pysftp.CnOpts()
cnOpts.hostkeys=None

with pysftp.Connection(host=sftphost,port=sftpport,username=uname,private_key=privatekeyfilepath, cnopts=cnOpts) as srv:
    print("connection successful")
    data = srv.listdir()
    srv.get("Test_Report1.csv")

import pandas as pd
df = pd.read_csv('Test_Report1.csv',encoding='latin-1')
df2=pd.DataFrame(data=df)
Alteryx.write(df2,1)
   

 

 

 

 

 

1 REPLY 1
KilianL
Alteryx Alumni (Retired)

Hi @AIPH123 ,

 

for your workflow to run on server, the server needs to have the same dependencies you have on your own machine.

In this case, the Python packages you are using need to be installed on the server machine also. You will need to reach out to your server admin to see if they can install the packages for you.

 

Alternatively, you can access an SFTP with the download tool also, see here: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Upload-to-SFTP-FTP/ta-p/20845

 

Please mark this as the solution if it answers your question, it will help others to find solutions quicker.

Kind Regards,
Kilian
Solutions Engineer - Alteryx

Labels
Top Solution Authors