使用 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 时如何消除不需要的调试输出 的相关文章

  • 如何在 Django 管理中以表格格式显示添加模型?

    我刚刚开始使用 Django 编写我的第一个应用程序 为我的家庭设计的家务图表管理器 在本教程中 它向您展示了如何添加相关对象 http docs djangoproject com en dev intro tutorial02 cust
  • 十六进制数的按位异或

    我们如何在 Python 中对十六进制数进行异或 例如 我想要异或 ABCD and 12EF 答案应该是 B922 我使用了下面的代码 但它给出了错误的结果 xor two strings of different lengths def
  • 禁用将应用程序窗口置于前面。关闭另一个窗口后

    我有包含 2 个 NSWindowController 的 OSX 应用程序 我的问题可以通过以下几个步骤来描述 使用 2 个窗口启动应用程序 选择另一个应用程序的窗口 将其中一个窗口放在另一个应用程序窗口前面 第二个窗口将保留在底部 关闭
  • 在 keras 中使用自定义张量流操作

    我在张量流中有一个脚本 其中包含自定义张量流操作 我想将代码移植到 keras 但我不确定如何在 keras 代码中调用自定义操作 我想在 keras 中使用tensorflow 所以到目前为止我发现的教程描述了与我想要的相反的内容 htt
  • 使用 Python 的文本中的词频但忽略停用词

    这给了我文本中单词的频率 fullWords re findall r w allText d defaultdict int for word in fullWords d word 1 finalFreq sorted d iterit
  • 属性错误:类型对象“图像”没有属性“打开”

    Exception in Tkinter callback Traceback most recent call last File C Python34 lib tkinter init py line 1482 in call retu
  • 当 DetailView 遇到时更新模型字段。 [姜戈]

    我有一个类似的 DetailViewviews py views py class CustomView DetailView context object name content model models AppModel templa
  • 在ansible中合并字典

    我目前正在构建一个使用 ansible 安装 PHP 的角色 并且在合并字典时遇到一些困难 我尝试了多种方法来做到这一点 但我无法让它像我想要的那样工作 A vars file my default values key value my
  • 管理文件字段当前 url 不正确

    在 Django 管理中 只要有 FileField 编辑页面上就会有一个 当前 框 其中包含指向当前文件的超链接 但是 此链接会附加到当前页面 url 因此会导致 404 因为不存在这样的页面 例如 http 127 0 0 1 8000
  • 有没有任何方法可以使用 openpyxl 获取 .xlsx 工作表中存在的行数和列数?

    有没有任何方法可以使用 openpyxl 获取 xlsx 工作表中存在的行数和列数 在xlrd中 sheet ncols sheet nrows 将给出列数和行数 openpyxl中有这样的方法吗 给定一个变量sheet 可以通过以下方式之
  • 在Python中计算结构体的CRC

    我有以下结构 来自 C 中的 NRPE 守护程序代码 typedef struct packet struct int16 t packet version int16 t packet type uint32 t crc32 value
  • Flask SQLAlchemy 与 MyPy - 模型类型错误

    我遇到了以下组合问题flask sqlalchemy and mypy 当我定义一个新的 ORM 对象时 例如 class Foo db Model pass where db是使用创建的数据库SQL炼金术应用于flask app mypy
  • 如何使用数据库在 Django 中的应用程序之间交换数据?

    我正在使用 Django 在网络上工作 我创建了 2 个应用程序 第一个用于客户端注册并将其数据添加到数据库 第二个应用程序供用户访问和查看交互界面 这个想法是使用第二个应用程序从数据库中的客户端获取数据 并使用它向用户显示一些信息 我的问
  • 使用 Flask-SQLAlchemy 进行多对多多数据库连接

    我正在尝试使这个多对多联接与 Flask SQLAlchemy 和两个 MySQL 数据库一起工作 并且它非常接近 只是它为联接表使用了错误的数据库 这是基础知识 我有main db and vendor db 表格设置为main db u
  • 对数据框的行进行排序

    我有以下数据框 adjusted RFC df Node Feature Indicator Scaled Class Direction True False 0 0 km lt 0 181 class 4 0 gt 1 NA 125 1
  • 网页抓取 - 如何识别网页上的主要内容

    给定一个新闻文章网页 来自任何主要新闻来源 例如时报或彭博社 我想识别该页面上的主要文章内容 并丢弃其他杂项元素 例如广告 菜单 侧边栏 用户评论 在大多数主要新闻网站上都可以使用的通用方法是什么 有哪些好的数据挖掘工具或库 最好是基于Py
  • Jupyter Notebook 中的多处理与线程

    我试图测试这个例子here https ipywidgets readthedocs io en stable examples Widget 20Asynchronous html将其从线程更改为多处理 在 jupyter Noteboo
  • Jinja2中获取请求参数

    如何检索请求参数a在 Jinja2 模板中 http foo bar a 1 我这个答案有点晚了 但其他解决方案并没有真正考虑到您对 Flask 的使用 事实上 您将 Flask 与 Jinja2 一起使用 这使得您的情况与其他框架有点不同
  • 如何让你的精灵在pygame中跳跃

    目前我已经制作了一个平台游戏 可以左右移动我的角色 他从地上开始 关于如何让他跳的任何想法 因为我不明白 目前 如果我按住向上键 我的玩家精灵将连续向上移动 或者如果我按下它 我的玩家精灵将向上移动并保持向上 我想找个办法远离他 让我重新跌
  • 在Python中从列表中获取n个项目组的惯用方法? [复制]

    这个问题在这里已经有答案了 给定一个列表 A 1 2 3 4 5 6 是否有任何惯用的 Pythonic 方式来迭代它 就好像它是 B 1 2 3 4 5 6 除了索引之外 这感觉像是 C 的遗留物 for a1 a2 in A i A i

随机推荐