python eoferror是什么异常

python eoferror是什么异常,第1张

出现“EOFError Python”,就意味着发现了一个不期望的文件尾,而这个文件尾通常是Ctrl-d引起的。

使用try ... except语句来处理异常,通常将语句放在try-块中,而把我们的错误处理语句放在except-块。

实例:

#!/usr/bin/python

#Filename : try_except.py

import sys

try:

s = raw_input('Enter something -->')

except EOFError: # catch EOFError

print '\nWhy did you do an EOF on me?'

sys.exit()# exit the program

except:   # Catch any error

print '\n Some error/exception occurrd.'

# here, we are not exiting the program

print 'Done'

except从句可以专门处理单一的错误或异常,或者一组包括在圆括号内的错误/异常,如果没有给出错误或异常的名称,它会处理所有的错误和异常。对于每一个try从句,至少有一个相关联的except从句。

gitlab 邮箱配置后, 发邮件报  EOFError: end of file reached  

基本上上因为配置端口和是否使用ssl配置不匹配导致的。

1 使用25端口, 就不要配置ssl相关项目

2 使用465(或者其他),应该将一下设置好

使用 gitlab-rails console 进入可以发送测试邮件

Notify.test_email('[email protected]',"sdfsdf", 'dsf').deliver_now

然后观察命令后的输出是否正确。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/12108236.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-21
下一篇 2023-05-21

发表评论

登录后才能评论

评论列表(0条)

保存