OSX 10.6.3 上的 Python2.6 未找到 Evt.TickCount()

发布于 2024-09-13 22:06:56 字数 963 浏览 2 评论 0原文

在Python2.6中,Evt模块(来自Carbon import Evt)似乎没有响应OSX上的TickCount()。但Python2.5 没问题:

from Carbon import Evt
s = Evt.TickCount()

在Python2.5 上我得到一个返回的整数。在 Python2.6 上我得到:

AttributeError: 'module' object has no attribute 'TickCount'

这是在 Snow Leopard 上。 OSX 上是否有一些库需要更新才能允许 TickCount() 工作?实际上,由于使用 py2app,我遇到了这个问题。

更新巴里的答案: 问题是 py2app 创建的应用程序在启动时给出:

  File "/Users/cybertoast/Projects/scripts/dist/fixcatalystlibs.app/Contents/Resources/__boot__.py", line 40, in mainloop
  [0x0-0x913913].org.pythonmac.unspecified.fixcatalystlibs[11722]       stoptime = Evt.TickCount() + timeout
  [0x0-0x913913].org.pythonmac.unspecified.fixcatalystlibs[11722]   AttributeError: 'module' object has no attribute 'TickCount'

我将 VERSIONER_PYTHON_PREFER_32_BIT=yes 添加到我的 .bash_profile 中,但 py2app 创建的应用程序仍然存在相同的问题。然而,Python 解释器对 32 位修复很满意。但仍然需要 py2app 的解决方案。

With Python2.6, the Evt module (from Carbon import Evt) does not have seem to respond to TickCount() on OSX. But Python2.5 is fine:

from Carbon import Evt
s = Evt.TickCount()

On Python2.5 I get a returned integer. On Python2.6 I get:

AttributeError: 'module' object has no attribute 'TickCount'

This is on Snow Leopard. Is there some library that needs to be updated on OSX to allow for TickCount() to work? I'm actually having this problem due to using py2app.

Update for Barry's answer:
The problem is that the application that py2app creates, when launched, gives me:

  File "/Users/cybertoast/Projects/scripts/dist/fixcatalystlibs.app/Contents/Resources/__boot__.py", line 40, in mainloop
  [0x0-0x913913].org.pythonmac.unspecified.fixcatalystlibs[11722]       stoptime = Evt.TickCount() + timeout
  [0x0-0x913913].org.pythonmac.unspecified.fixcatalystlibs[11722]   AttributeError: 'module' object has no attribute 'TickCount'

I added VERSIONER_PYTHON_PREFER_32_BIT=yes to my .bash_profile, but the app that py2app creates still has the same problem. The python interpreter, however is happy with the 32-bit fix. But still need a solution to py2app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

残花月 2024-09-20 22:06:56

由于损坏的代码仅用于 argv 模拟,因此我可以通过禁用 argv 模拟来让我的应用程序正常工作。这可以通过将 py2app OPTIONS 哈希中的“argv_emulation”键设置为 False 来完成。

例子:

APP = ['MyApp.py']
OPTIONS = { 
   'argv_emulation': False,
   ...
}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

Since the broken code was only being used for argv emulation, I was able to get my app working by disabling argv emulation. This can be done by setting the 'argv_emulation' key in the py2app OPTIONS hash to False.

Example:

APP = ['MyApp.py']
OPTIONS = { 
   'argv_emulation': False,
   ...
}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)
墨小墨 2024-09-20 22:06:56

我一直在使用的代码需要使用 argv_emulation,因此上述解决方案对我没有帮助。最后,我在plist文件中使用了LSArchitecturePriority,将其设置为i386。这解决了我的问题,并允许我将 argv_emulation 设置为 True。

更多信息可以在这里找到:http ://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#/

The code I have been using requires the use of argv_emulation, so the above solutions have not aided me. In the end, I made use of LSArchitecturePriority in the plist file, setting it to i386. This solved my problem, and allowed me to keep the argv_emulation set to True.

More info can be found here: http://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#/

多彩岁月 2024-09-20 22:06:56

Python 在 Snow Leopard 中默认以 64 位模式运行。看来 Carbon.Evt 尚未过渡到完全 64 位兼容性。您可以通过尝试在 32 位模式下运行来确认这一点(请参阅 man python):

oso:~ barry$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
oso:~ barry$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Carbon.Evt as evt
>>> evt.TickCount()
2973070
>>> 

因此,要么在 32 位模式下运行 py2app,要么告诉我们您的情况我们正在尝试这样做,也许我们可以提供 64 位兼容的替代方案。

Python runs in 64-bit mode by default in Snow Leopard. It appears that Carbon.Evt hasn't made the transition to full 64-bit compatibility. You can confirm this by trying to run in 32-bit mode (see man python):

oso:~ barry$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
oso:~ barry$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Carbon.Evt as evt
>>> evt.TickCount()
2973070
>>> 

So, either run py2app in 32-bit mode, or tell us what you're trying to do and perhaps we can provide a 64-bit compatible alternative.

心作怪 2024-09-20 22:06:56

最简单的解决方案可能是使用另一种 32 位 Python,而不是 10.6 中 Apple 提供的 Python - 例如,使用 python.org 安装程序。如果您想将您的应用程序作为可在多个 OS X 版本上使用的独立应用程序进行分发,则无论如何您都需要这样做。

Probably the easiest solution is to use another, 32-bit-only Python instead of the Apple-supplied one in 10.6 - for example, install Python 2.6 using the python.org installer. If you want to distribute your app as a standalone app that can be used on multiple OS X versions, you'll need to do that anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文