0

I want to read a json file from my server:103.227.176.29 but got an error"invalid literal for int() with base 10: '103.227.176.29" and I don't know how to fix it. What can I do to fix this problem?

from contextlib     import closing
from fabric.network import connect
user = 'cortekr1_cuong' 
password = '12345678'
host = '103.227.176.29' 
port = '3306' 
remote_file = '/RBICloudv1/static/json/vietnamprovince/vn.json'
with closing(connect(user, password, host, port)) as ssh, \
     closing(ssh.open_sftp()) as sftp, \
     closing(sftp.open(remote_file)) as file:
    for line in file:
      print(line) 
3
  • This post will answer your question:stackoverflow.com/questions/62850543/… Commented Aug 29, 2021 at 14:22
  • 2
    Post the traceback. We shouldn't have to guess where the error is. Commented Aug 29, 2021 at 14:28
  • Please provide enough code so others can better understand or reproduce the problem. Commented Aug 31, 2021 at 11:57

1 Answer 1

2

Password is not a parameter, so you're trying to pass the host as the port, which it's not a number

https://docs.fabfile.org/en/1.12.1/api/core/network.html#fabric.network.connect

By the way, port 3306 is commonly used for mysql, not an sftp server

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.