带有解析的URL的Python ftplib getaddrinfo错误

问题描述

我创建了一个功能,该功能应该从以下特定的ftp服务下载文件:ftp://cddis.gsfc.nasa.gov/gnss/products/bias/2013,其中用户只给出了一个吸引他的年份。我正在尝试解析服务器地址,我认为它已经完成了(应该是印刷版本),但我仍然得到:[Errno 11001] getaddrinfo failed,我的问题是为什么?

sinex_domain = "ftp://cddis.gsfc.nasa.gov/gnss/products/bias/2013"

def download(sinex_domain):
    user = getpass.getuser()
    sinex_parse = urlparse(sinex_domain)

    sinex_connetion = FTP(sinex_parse.scheme+'.'+sinex_parse.netloc)
    sinex_connetion.login()
    sinex_connetion.cwd(sinex_parse.path)
    sinex_files = sinex_connetion.nlst()
    sinex_userpath = "C:\\Users\\" + user + "\\DCBviz\\sinex"
    pathlib.Path(sinex_userpath).mkdir(parents=True,exist_ok=True)

    for fileName in sinex_files:
        local_filename = os.path.join(sinex_userpath,fileName)
        file = open(local_filename,'wb')
        sinex_connetion.retrbinary('RETR '+ fileName,file.write,1024)
            
        file.close()

    sinex_connetion.quit()

download(sinex_domain)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...