python - 为什么我不能使用 Python 连接到我的 FTP 服务器?
问题描述
为什么我无法连接到我的 FTP?当我指定一个端口时,我收到错误“socket.gaierror: [Errno -2] name of service not known”,当我没有指定我的端口时,我收到 [errno 111] Connection denied。我究竟做错了什么?
from ftplib import FTP
from pathlib import Path
file_path = ('TEST.txt')
with FTP('url:port', 'user', 'pass') as ftp,
open(file_path, 'rb') as file:
ftp.storbinary(f'STOR {file_path.name}', file)
解决方案
推荐阅读
- python - 用特殊字符编码密码
- javascript - app.post('/login') 总是无法验证用户身份
- python-3.x - Kivy 无限循环滚动视图
- python - 如何检查一个迭代的哪些元素也在另一个迭代中?
- hibernate - 当 where 子句包含“is null”时,休眠查询将永远运行
- r - 多重滤镜闪亮
- python - 如何降低列表的维度
- asp.net-core - Microsoft.AspNetCore.Authentication.OpenIdConnect /oauth2/authorize 端点表单-redirect_uri 错误
- json - 是否有任何工具可以从数据库值生成 Json 模式?
- gcloud - 在谷歌云上安装 Janusgraph