使用 Python 3.7 导入 pyobjc AppKit 时如何消除不需要的调试输出

2024-01-12

由单个语句组成的脚本

import AppKit

使用 Python 3.7 将以下内容打印到 stdout/stderr(也可能是其他 3.x 版本,但不使用 Python 2.7)

bool b'B' <classmethod object at 0x10b41e510> <function ivar.bool at 0x10b464440>
char b'c' <classmethod object at 0x10b41e4d0> <function ivar.char at 0x10b4644d0>
int b'i' <classmethod object at 0x10b41e0d0> <function ivar.int at 0x10b464560>
short b's' <classmethod object at 0x10b41e210> <function ivar.short at 0x10b4645f0>
long b'l' <classmethod object at 0x10b41a790> <function ivar.long at 0x10b464680>
long_long b'q' <classmethod object at 0x10b41af50> <function ivar.long_long at 0x10b464710>
unsigned_char b'C' <classmethod object at 0x10b41aa50> <function ivar.unsigned_char at 0x10b4647a0>
unsigned_int b'I' <classmethod object at 0x10b41afd0> <function ivar.unsigned_int at 0x10b464830>
unsigned_short b'S' <classmethod object at 0x10b41af10> <function ivar.unsigned_short at 0x10b4648c0>
unsigned_long b'L' <classmethod object at 0x10b41ac90> <function ivar.unsigned_long at 0x10b464950>
unsigned_long_long b'Q' <classmethod object at 0x10b41ad10> <function ivar.unsigned_long_long at 0x10b4649e0>
float b'f' <classmethod object at 0x10b41ad90> <function ivar.float at 0x10b464a70>
double b'd' <classmethod object at 0x10b41ae50> <function ivar.double at 0x10b464b00>
BOOL b'Z' <classmethod object at 0x10b41a5d0> <function ivar.BOOL at 0x10b464b90>
UniChar b'T' <classmethod object at 0x10b41a9d0> <function ivar.UniChar at 0x10b464c20>
char_text b't' <classmethod object at 0x10b41a910> <function ivar.char_text at 0x10b464cb0>
char_int b'z' <classmethod object at 0x10b41ab90> <function ivar.char_int at 0x10b464d40>
CFXMLEntityInfo b'{_CFXMLEntityInfo=q^{__CFString=}{_CFXMLExternalID=^{__CFURL=}^{__CFString=}}^{__CFString=}}' <classmethod object at 0x10b4eee10> <function ivar.CFXMLEntityInfo at 0x10b4c4cb0>
CFXMLElementInfo b'{_CFXMLElementInfo=^{__CFDictionary=}^{__CFArray=}Z[3c]}' <classmethod object at 0x10b4f30d0> <function ivar.CFXMLElementInfo at 0x10b4c4d40>
CFXMLAttributeListDeclarationInfo b'{_CFXMLAttributeListDeclarationInfo=q^{_CFXMLAttributeDeclarationInfo=^{__CFString=}^{__CFString=}^{__CFString=}}}' <classmethod object at 0x10b4f3210> <function ivar.CFXMLAttributeListDeclarationInfo at 0x10b4c4e60>
CFXMLElementTypeDeclarationInfo b'{_CFXMLElementTypeDeclarationInfo=^{__CFString=}}' <classmethod object at 0x10b4f33d0> <function ivar.CFXMLElementTypeDeclarationInfo at 0x10b4c4ef0>
CFGregorianDate b'{_CFGregorianDate=iccccd}' <classmethod object at 0x10b4f3690> <function ivar.CFGregorianDate at 0x10b4f7050>
CFXMLExternalID b'{_CFXMLExternalID=^{__CFURL=}^{__CFString=}}' <classmethod object at 0x10b4f3810> <function ivar.CFXMLExternalID at 0x10b4f70e0>
CFUUIDBytes b'{_CFUUIDBytes=CCCCCCCCCCCCCCCC}' <classmethod object at 0x10b4f3d50> <function ivar.CFUUIDBytes at 0x10b4f7170>
CFXMLAttributeDeclarationInfo b'{_CFXMLAttributeDeclarationInfo=^{__CFString=}^{__CFString=}^{__CFString=}}' <classmethod object at 0x10b4f3f10> <function ivar.CFXMLAttributeDeclarationInfo at 0x10b4f7200>
CFSwappedFloat32 b'{_CFSwappedFloat32=I}' <classmethod object at 0x10b4fc0d0> <function ivar.CFSwappedFloat32 at 0x10b4f7290>
CFSwappedFloat64 b'{_CFSwappedFloat64=Q}' <classmethod object at 0x10b4fc250> <function ivar.CFSwappedFloat64 at 0x10b4f7320>
CFXMLDocumentTypeInfo b'{_CFXMLDocumentTypeInfo={_CFXMLExternalID=^{__CFURL=}^{__CFString=}}}' <classmethod object at 0x10b4fc3d0> <function ivar.CFXMLDocumentTypeInfo at 0x10b4f73b0>
CFStreamError b'{_CFStreamError=qi}' <classmethod object at 0x10b4fc590> <function ivar.CFStreamError at 0x10b4f7440>
CFXMLEntityReferenceInfo b'{_CFXMLEntityReferenceInfo=q}' <classmethod object at 0x10b4fc750> <function ivar.CFXMLEntityReferenceInfo at 0x10b4f74d0>
CFXMLProcessingInstructionInfo b'{_CFXMLProcessingInstructionInfo=^{__CFString=}}' <classmethod object at 0x10b4fc950> <function ivar.CFXMLProcessingInstructionInfo at 0x10b4f7560>
CFRange b'{_CFRange=qq}' <classmethod object at 0x10b4fcb50> <function ivar.CFRange at 0x10b4f7680>
CFSocketSignature b'{_CFSocketSignature=iii^{__CFData=}}' <classmethod object at 0x10b4fcd50> <function ivar.CFSocketSignature at 0x10b4f7710>
CFXMLDocumentInfo b'{_CFXMLDocumentInfo=^{__CFURL=}I}' <classmethod object at 0x10b4fced0> <function ivar.CFXMLDocumentInfo at 0x10b4f77a0>
CFGregorianUnits b'{_CFGregorianUnits=iiiiid}' <classmethod object at 0x10b5041d0> <function ivar.CFGregorianUnits at 0x10b4f7830>
CFXMLNotationInfo b'{_CFXMLNotationInfo={_CFXMLExternalID=^{__CFURL=}^{__CFString=}}}' <classmethod object at 0x10b504350> <function ivar.CFXMLNotationInfo at 0x10b4f78c0>
NSEdgeInsets b'{NSEdgeInsets=dddd}' <classmethod object at 0x10b59ac90> <function ivar.NSEdgeInsets at 0x10b571560>
NSHashEnumerator b'{_NSHashEnumerator=QQ^v}' <classmethod object at 0x10b59ae90> <function ivar.NSHashEnumerator at 0x10b5715f0>
NSAffineTransformStruct b'{_NSAffineTransformStruct=dddddd}' <classmethod object at 0x10b59f150> <function ivar.NSAffineTransformStruct at 0x10b571680>
NSRect b'{CGRect={CGPoint=dd}{CGSize=dd}}' <classmethod object at 0x10b59f310> <function ivar.NSRect at 0x10b571710>
NSOperatingSystemVersion b'{_NSOperatingSystemVersion=qqq}' <classmethod object at 0x10b59f510> <function ivar.NSOperatingSystemVersion at 0x10b5717a0>
NSZone b'{_NSZone=}' <classmethod object at 0x10b59f690> <function ivar.NSZone at 0x10b571830>
NSDecimal b'{_NSDecimal=b8b4b1b1b18[8S]}' <classmethod object at 0x10b59f990> <function ivar.NSDecimal at 0x10b5718c0>
NSSize b'{CGSize=dd}' <classmethod object at 0x10b59fb90> <function ivar.NSSize at 0x10b571950>
NSPoint b'{CGPoint=dd}' <classmethod object at 0x10b59fd10> <function ivar.NSPoint at 0x10b5719e0>
NSSwappedDouble b'{_NSSwappedDouble=Q}' <classmethod object at 0x10b59fe90> <function ivar.NSSwappedDouble at 0x10b571a70>
NSMapEnumerator b'{_NSMapEnumerator=QQ^v}' <classmethod object at 0x10b5a70d0> <function ivar.NSMapEnumerator at 0x10b571b00>
NSSwappedFloat b'{_NSSwappedFloat=I}' <classmethod object at 0x10b5a7250> <function ivar.NSSwappedFloat at 0x10b571b90>
NSRange b'{_NSRange=QQ}' <classmethod object at 0x10b5a7450> <function ivar.NSRange at 0x10b571c20>
NSDirectionalEdgeInsets b'{NSDirectionalEdgeInsets=dddd}' <classmethod object at 0x10b6d1d90> <function ivar.NSDirectionalEdgeInsets at 0x10b651710>
NSOpenGLPixelFormatAuxiliary b'{_CGLPixelFormatObject=}' <classmethod object at 0x10b6d1ed0> <function ivar.NSOpenGLPixelFormatAuxiliary at 0x10b6517a0>
NSScreenAuxiliaryOpaque b'{NSScreenAuxiliary=}' <classmethod object at 0x10b6d7050> <function ivar.NSScreenAuxiliaryOpaque at 0x10b651830>
NSOpenGLContextAuxiliary b'{_CGLContextObject=}' <classmethod object at 0x10b6d7190> <function ivar.NSOpenGLContextAuxiliary at 0x10b6518c0>

...一些细节,因为 SO 显然已将其适得其反的迂腐精神具体化到其产品代码中,否则不会让我提交...


这是 PyObjC 6.0 中的一个错误。我刚刚发布了 PyObjC 6.0.1 修复了这个错误。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Python 3.7 导入 pyobjc AppKit 时如何消除不需要的调试输出 的相关文章

  • Python 3 中“map”类型的对象没有 len()

    我在使用 Python 3 时遇到问题 我得到了 Python 2 7 代码 目前我正在尝试更新它 我收到错误 类型错误 map 类型的对象没有 len 在这部分 str len seed candidates 在我像这样初始化它之前 se
  • 设置 torch.gather(...) 调用的结果

    我有一个形状为 n x m 的 2D pytorch 张量 我想使用索引列表来索引第二个维度 可以使用 torch gather 完成 然后然后还设置新值到索引的结果 Example data torch tensor 0 1 2 3 4
  • 在 Pandas DataFrame Python 中添加新列[重复]

    这个问题在这里已经有答案了 例如 我在 Pandas 中有数据框 Col1 Col2 A 1 B 2 C 3 现在 如果我想再添加一个名为 Col3 的列 并且该值基于 Col2 式中 如果Col2 gt 1 则Col3为0 否则为1 所以
  • glpk.LPX 向后兼容性?

    较新版本的glpk没有LPXapi 旧包需要它 我如何使用旧包 例如COBRA http opencobra sourceforge net openCOBRA Welcome html 与较新版本的glpk 注意COBRA适用于 MATL
  • 如何使用google colab在jupyter笔记本中显示GIF?

    我正在使用 google colab 想嵌入一个 gif 有谁知道如何做到这一点 我正在使用下面的代码 它并没有在笔记本中为 gif 制作动画 我希望笔记本是交互式的 这样人们就可以看到代码的动画效果 而无需运行它 我发现很多方法在 Goo
  • Python - 字典和列表相交

    给定以下数据结构 找出这两种数据结构共有的交集键的最有效方法是什么 dict1 2A 3A 4B list1 2A 4B Expected output 2A 4B 如果这也能产生更快的输出 我可以将列表 不是 dict1 组织到任何其他数
  • 改变字典的哈希函数

    按照此question https stackoverflow com questions 37100390 towards understanding dictionaries 我们知道两个不同的字典 dict 1 and dict 2例
  • Pandas 与 Numpy 数据帧

    看这几行代码 df2 df copy df2 1 df 1 df 1 values 1 df2 ix 0 0 我们的教练说我们需要使用 values属性来访问底层的 numpy 数组 否则我们的代码将无法工作 我知道 pandas Data
  • 如何在 OSX 上安装 LaTeX .sty 文件?

    我设置了一个 LaTeX 项目 tex documents some file tex support todonotes sty where some file tex uses todonotes usepackage colorinl
  • PyAudio ErrNo 输入溢出 -9981

    我遇到了与用户相同的错误 Python 使用 Pyaudio 以 16000Hz 录制音频时出错 https stackoverflow com questions 12994981 python error audio recording
  • Vim 和 Mac:如何在不使用 pbcopy 的情况下复制到剪贴板

    我有一个同时支持剪贴板和 xterm clipboard 的 vim 版本 然而 y or y不要复制到系统剪贴板 我知道我可以使用 w pbcopy 甚至为其创建快捷方式 但我真的想要标准方式 我也看到了 fakeclip 但希望找到一个
  • Keras 模型无法预测是否在线程中调用

    我尝试在线程应用程序中使用 keras 和可用模型 VGG16 执行预测 但是 如果我在主线程中调用预测 一切都会正常 但是如果我在线程函数内部进行预测 无论我使用threading multiprocessing 它只是在预测过程中停止
  • 使用 Flask 和 SQLAlchemy 在 Celery 任务中未更新数据库

    我正在使用 Flask 和 SQLAlchemy 编写 Web 应用程序 我的程序需要在后台处理一些内容 然后将这些内容标记为在数据库中已处理 使用标准 Flask Celery 示例 http flask pocoo org docs 0
  • Flask-login:无法理解它是如何工作的

    我试图理解如何Flask Login https flask login readthedocs org en latest works 我在他们的文档中看到他们使用预先填充的用户列表 我想使用数据库存储的用户列表 但是 我不明白其中的一些
  • Python str.format() 方法的默认 kwarg 值

    我希望尝试使现有字符串的复数化尽可能简单 并且想知道是否有可能得到str format 在查找 kwargs 时解释默认值 这是一个例子 string number of sheep sheep has run away dict comp
  • 为什么我应该在 Python 中引用“名称”和“绑定”而不是“变量”和“赋值”?

    为什么我应该在 Python 中引用 名称 和 绑定 而不是 变量 和 赋值 我知道这个问题有点笼统 但我真的很想知道 在 C 和 C 中 变量是命名的内存位置 变量的值是存储在该位置的值 分配给变量并修改该值 所以变量是内存位置 而不是它
  • 运行 Sublime Text 3 插件时保存编辑

    为了理解我想要实现的目标 在另一个视图中打印延迟文本 我正在尝试使这个 sublime text 3 插件正常运行我想使用运行方法参数中传递的编辑来调用我的类的多个方法 如下所示 sample code nothing real class
  • R 的 ggplot2 有 Python API 吗? [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我的问题就像标题一样简单 我想使用R s ggplot2但我所有的数据处理都是在Python 有没有Py
  • 使用 QuantLib 计算带有下限的 FloatingRateBond 的现金流量

    对 QuantLib 非常陌生 所以猜测这是一个菜鸟错误 很高兴了解这个强大的库 所以感谢作者和贡献者 如果没有下限参数 我可以在没有定价器的情况下为 FloatingRateBond 生成现金流量金额 所以我不明白为什么包含下限参数需要定
  • 无法“安装”plpython3u - postgresql

    我正在尝试在 postgresql 中使用 python 语言 像这样的事情 create or replace function test a integer returns integer as if a 2 0 return even

随机推荐