Unable to run a saved Jupyter notebook

68 Views Asked by At

I am new to python, I have a sample python script which runs successfully from a new notebook in Jupyter. When the script is saved and re-opened it fails with name error.

Below sample script:

import paramiko
from TM1py import TM1Service

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname = "sftp.xxxxx.com",username  = 'Test user', password = 'abcd', port=22)
sftp_client = ssh.open_sftp()
sftp_client.get(source,dest)
sftp_client.close()
ssh.close()
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname = 'sftp-xxxxxx.com',username  = 'Test user', password = 'abcd',port = 22)
sftp_client = ssh.open_sftp()
sftp_client.put(source,dest)    
sftp_client.close()
ssh.close()
0

There are 0 best solutions below