24540

Evt.TickCount() not found with Python2.6 on OSX 10.6.3

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.

<strong>Update for Barry's answer:</strong> 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.

Answer1:

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'], )

Answer2:

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#/

Answer3:

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.

Answer4:

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.

Recommend

  • How to make a bash_profile function acts different running within bash_profile or later called by us
  • Mac Indexing and CLASSPATH problems - java.lang.NoClassDefFoundError
  • how do I update PYTHONPATH from /usr/local/bin/python to /usr/bin/python
  • Bash Command which Rails does Not Find
  • ln: /usr/bin/mysql: Operation not permitted
  • Configuring a Rails 4 app for production in a subdirectory under Apache
  • shell script not running via crontab, runs fine manually
  • brew install npm “npm: command not found”
  • -bash: export: `“JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home”':
  • Disable history in Linux [closed]
  • Alias with Argument in Bash - Mac [duplicate]
  • mac java setting error
  • backspace not working in macvim shell
  • Default Ruby not loading with RVM
  • edit bash command gcc to compile and execute in one line
  • Is it possible to set the path using an install shell script?
  • How do I prevent Conda from activating the base environment by default?
  • Showing git branch in shell prompt?
  • RVM Installation and permission issue
  • Issue with running .bash_profile by ansible
  • Evt.TickCount() not found with Python2.6 on OSX 10.6.3
  • Run a php script only from Cron or check if request from cron?
  • Difference in memory layout of pointer to base and pointer to derived object
  • active directory findone() method
  • setting path in terminal
  • Why does the official JVM documentation contradict its implementation in addShutdownHook?
  • Printing list elements and strings in Python have different results
  • Issue loading 'dplyr' packages
  • Left and right button misbehaving when trying to add an empty span to contenteditable div
  • Insert Statement
  • Read a local file using javascript
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • Cross-Platform Protobuf Serialization
  • How can I use Kendo UI with Razor?
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?