鱼C论坛

 找回密码
 立即注册
查看: 297|回复: 1

[技术交流] ConnectionRefusedError--PythonBIF(13)

[复制链接]
发表于 2025-1-27 20:41:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 zyx2012 于 2025-1-27 02:43 编辑

原文:

  1. Help on class ConnectionRefusedError in module builtins:

  2. class ConnectionRefusedError(ConnectionError)
  3. |  Connection refused.
  4. |
  5. |  Method resolution order:
  6. |      ConnectionRefusedError
  7. |      ConnectionError
  8. |      OSError
  9. |      Exception
  10. |      BaseException
  11. |      object
  12. |
  13. |  Methods defined here:
  14. |
  15. |  __init__(self, /, *args, **kwargs)
  16. |      Initialize self.  See help(type(self)) for accurate signature.
  17. |
  18. |  ----------------------------------------------------------------------
  19. |  Methods inherited from OSError:
  20. |
  21. |  __reduce__(self, /)
  22. |      Helper for pickle.
  23. |
  24. |  __str__(self, /)
  25. |      Return str(self).
  26. |
  27. |  ----------------------------------------------------------------------
  28. |  Static methods inherited from OSError:
  29. |
  30. |  __new__(*args, **kwargs) class method of builtins.OSError
  31. |      Create and return a new object.  See help(type) for accurate signature.
  32. |
  33. |  ----------------------------------------------------------------------
  34. |  Data descriptors inherited from OSError:
  35. |
  36. |  characters_written
  37. |
  38. |  errno
  39. |      POSIX exception code
  40. |
  41. |  filename
  42. |      exception filename
  43. |
  44. |  filename2
  45. |      second exception filename
  46. |
  47. |  strerror
  48. |      exception strerror
  49. |
  50. |  winerror
  51. |      Win32 exception code
  52. |
  53. |  ----------------------------------------------------------------------
  54. |  Methods inherited from BaseException:
  55. |
  56. |  __getattribute__(self, name, /)
  57. |      Return getattr(self, name).
  58. |
  59. |  __repr__(self, /)
  60. |      Return repr(self).
  61. |
  62. |  __setstate__(self, object, /)
  63. |
  64. |  add_note(self, object, /)
  65. |      Exception.add_note(note) --
  66. |      add a note to the exception
  67. |
  68. |  with_traceback(self, object, /)
  69. |      Exception.with_traceback(tb) --
  70. |      set self.__traceback__ to tb and return self.
  71. |
  72. |  ----------------------------------------------------------------------
  73. |  Data descriptors inherited from BaseException:
  74. |
  75. |  __cause__
  76. |      exception cause
  77. |
  78. |  __context__
  79. |      exception context
  80. |
  81. |  __dict__
  82. |
  83. |  __suppress_context__
  84. |
  85. |  __traceback__
  86. |
  87. |  args
复制代码

翻译:

  1. 模块内置程序中 ConnectionRefusedError 类的帮助:

  2. 类 ConnectionRefusedError(ConnectionError)
  3. | 连接被拒绝。
  4. |
  5. | 方法解析顺序:
  6. | ConnectionRefusedError
  7. | 连接错误
  8. | OSError
  9. | 异常
  10. | 基本异常
  11. | 对象
  12. |
  13. | 这里定义的方法:
  14. |
  15. | __init__(self, /, *args, **kwargs)
  16. | 初始化自身。 有关准确的签名,请参见 help(type(self)) 。
  17. |
  18. | ----------------------------------------------------------------------
  19. | 继承自 OSError 的方法:
  20. |
  21. | __reduce__(self, /)
  22. | 为 pickle 提供帮助。
  23. |
  24. | __str__(self, /)
  25. | 返回 str(self)。
  26. |
  27. | ----------------------------------------------------------------------
  28. | 继承自 OSError 的静态方法:
  29. |
  30. | buildins.OSError 的类方法 __new__(*args, **kwargs)
  31. | 创建并返回一个新对象。 请参见 help(type) 获取准确的签名。
  32. |
  33. | ----------------------------------------------------------------------
  34. | 从 OSError 继承的数据描述符:
  35. |
  36. | 字符写入
  37. |
  38. | Erno
  39. | POSIX 异常代码
  40. |
  41. | 文件名
  42. | 异常文件名
  43. |
  44. | 文件名2
  45. | 第二个异常文件名
  46. |
  47. | stringerror
  48. | 异常 strerror
  49. |
  50. | winerror
  51. | Win32 异常代码
  52. |
  53. | ----------------------------------------------------------------------
  54. | 继承自 BaseException 的方法:
  55. |
  56. | __getattribute__(self, name, /)
  57. | 返回 getattr(self,name)。
  58. |
  59. | __repr__(self, /)
  60. | 返回 repr(self)。
  61. |
  62. | __setstate__(self, object, /)
  63. |
  64. | add_note(self, object, /)
  65. | Exception.add_note(note) --
  66. | 为异常添加注释
  67. |
  68. | with_traceback(self, object, /)
  69. | Exception.with_traceback(tb) -- | 为异常添加注释。
  70. | 将 self.__traceback__ 设为 tb 并返回 self。
  71. |
  72. | ----------------------------------------------------------------------
  73. | 从 BaseException 继承的数据描述符:
  74. |
  75. | __cause__
  76. | 异常原因
  77. |
  78. | __context__
  79. | 异常上下文
  80. |
  81. | __dict__
  82. |
  83. | __suppress_context__
  84. |
  85. | __traceback__
  86. |
  87. | args
复制代码


当客户端无法连接到服务器时,会出现 Python 中的 ConnectionRefusedError。 几个原因包括客户端不知道 IP 或端口地址,以及当客户端想要连接时服务器未运行。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2025-1-27 20:41:50 | 显示全部楼层
ConnectionRefusedError--PythonBIF

帮助信息:

这是关于内置模块中 ConnectionRefusedError 类的帮助文档。

ConnectionRefusedErrorConnectionError 的一个子类,表示连接被拒绝的情况。

方法解析顺序:
  • ConnectionRefusedError
  • ConnectionError
  • OSError
  • Exception
  • BaseException
  • object


该类的一些主要方法包括:
  • __init__(self, /, *args, **kwargs): 初始化自身。
  • __reduce__(self, /): 为 pickle 提供帮助。
  • __str__(self, /): 返回字符串形式的异常信息。
  • __new__(*args, **kwargs): 创建并返回一个新对象。
  • add_note(self, object, /): 为异常添加注释。
  • with_traceback(self, object, /): 设置 tracebak 信息并返回异常对象。


当客户端无法连接到服务器时,会出现 Python 中的 ConnectionRefusedError。可能的原因包括:
  • 客户端不知道 IP 或端口地址。
  • 客户端想要连接时服务器未运行。


希望这些信息对你有帮助!如果还有其他问题,请随时提问。

以上回复来自 FishC AI 小助理,如未能正确解答您的问题,请继续追问。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-6 02:59

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表