求 Py 大神帮忙看一眼,这个 Python 程序哪里有错误? - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ljq29

求 Py 大神帮忙看一眼,这个 Python 程序哪里有错误?

  •  
  •   ljq29 May 11, 2019 2523 views
    This topic created in 2558 days ago, the information mentioned may be changed or developed.

    把手头的一个 ftp 程序升级成为 ssl 传输,客户端用的是 ftplib 包编写,服务端是 File Zilla。 现在上传文件能够正常上传上去,但是退出的时候会报错。

    客户端这样报错:

    客户端这样报错

    服务端这样报错:

    服务端这样报错

    第四十行是这样写的:

    ftp.storbinary('STOR ' + os.path.basename(new_file_name),file)

    Supplement 1    May 11, 2019
    现在用 try/catch 跳过了这个报错点。

    奇怪的是,尽管报错,文件还是能够正常传到 ftp 服务器并保存成功的,只是跳过报错就不能了解到到底是不是真的把文件上传成功了。
    3 replies    2019-05-13 16:27:50 +08:00
    CallMeReznov
        1
    CallMeReznov  
       May 11, 2019
    fp.close
    ftp.quit()
    ljq29
        2
    ljq29  
    OP
       May 11, 2019
    @CallMeReznov
    附近的代码是这样的:
    '''
    new_file_name = time.strftime("%Y%m%d%H%M%S", time.localtime())+'-'+os.path.basename(file_name)
    file=open(file_name,"rb")
    show_msg(file_name+' is uploading')
    ftp.storbinary('STOR %s'%os.path.basename(new_file_name),file)
    ftp.set_debuglevel(0)
    file.close()
    try:
    ftp.quit()
    except:
    ftp.close()
    '''
    ljq29
        3
    ljq29  
    OP
       May 13, 2019
    @CallMeReznov
    后面的代码有这些啊,但是报错是在 close 前面报错的。
    About     Help     Advertise     Blog     API     FAQ     Solana     3312 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 40ms UTC 13:08 PVG 21:08 LAX 06:08 JFK 09:08
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86