[GRASS-dev] Re: problem with CheckForWx in wxGUI

Glynn Clements glynn at gclements.plus.com
Sun Jul 27 09:18:17 EDT 2008


Michael Barton wrote:

> A little more investigation has shown this. The following code does  
> not work on a Mac with new versions of wxPython.
> 
> def CheckForWx():
>      """Try to import wx module and check its version"""
> 
>      majorVersion = 2.8
>      minorVersion = 1.1
> 
>      try:
>          import wxversion
>          wxversion.select(str(majorVersion))
>          import wx
> 
> The problem lies in wxversion.select. It is looking for the SOURCE  
> CODE files in a BINARY wxPython installation. They simply are not  
> there. Here is what happens if I run this in the Python interpreter.
> 
>  >>> import wx
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "//Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45,  
> in <module>
>    File "//Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in  
> <module>
> ImportError: No module named _core_
>  >>>
> 
> Note, it is checking for _core.py.

No it isn't. Look at the error message:

	ImportError: No module named _core_

It's looking for a module name _core_ (with a trailing underscore). 
This is the binary extension (_core_.so on Linux). It should be in 

The files listed in the backtrace are the Python files which were
being executed at the point that the error occurred. The backtrace
always refers to the .py files even if .pyc or .pyo files are actually
used.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list