jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.6k stars 4.87k forks source link

NameError when trying to open a saved file from Jupyter notebook #6022

Open ards14 opened 3 years ago

ards14 commented 3 years ago

Hi All,

I am new to jupyter notebook, i have tm1py script which runs fine from a new jupyter notebook . When the notebook is saved and reopened ,the saved notebook returns below error:

NameError: name 'paramiko' is not defined

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-xxxxx.com',username  = 'test user', password = 'abcd',port = 22)
sftp_client = ssh.open_sftp()
sftp_client.put('source','dest')    
sftp_client.close()
ssh.close()
kevin-bates commented 3 years ago

Hmm - that is odd. Please ensure the import paramiko statement is run. The behavior you report is as if it wasn't.