Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Battling with wxpython

I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far:

  • If you are running python 2.6 or greater you can only work with wxpython if you access the 32-bit version
  • Typing python at the command line prompt reveals that I am using python 2.6.1.
  • Typing which python returns /usr/bin/python so I'm using the default version installed with my OS. This means that typing the following at the command line prompt defaults write com.apple.versioner.python Prefer-32-Bit -bool yes should change the version I'm using to the 32 bit version.
  • With the above in place, I can now simply type the name of my python file (with the wx module imported) and my file will run successfully.

As you can no doubt guess however my file doesn't run successfully. I can't figure out what's going on, but maybe someone else can here are some other observations that might help...

typing help(), modules yields the following message and then prints out the modules, including wx and wxpython

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible.

__import__(name)

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained.

__import__(name)

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead

import sha

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future. warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.")

Fri Jun 3 22:23:48 Paul-Pattersons-MacBook-Pro.local python[3208] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

Then examining the wx module specifially yields...

NAME wx

FILE /usr/local/lib/wxPython-unicode-2.8.12.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/__init__.py

Can anyone help?

like image 418
Paul Patterson Avatar asked Jun 03 '11 20:06

Paul Patterson


1 Answers

I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it.

As for the 32-bit question, with wxPython 2.8, you are correct. You are limited to 32-bit because of the Carbon API. However, if you scroll down the download page (http://wxpython.org/download.php) you will see that wxPython 2.9 has been released and it has a Cocoa build which (and I quote) "requires at least OSX 10.5, and supports either 32-bit or 64-bit architectures" and Python 2.7.

I highly recommend that you go and seek help on the wxPython mailing list. The author of wxPython is there and he uses a Mac and there are several other Mac addicts on the list too that answer these sorts of questions.

like image 50
Mike Driscoll Avatar answered Sep 26 '22 11:09

Mike Driscoll