[GRASS-user] import wx

Hi list,

I’writing a python-script with a wx-gui (not in grass style) including some grass-commands.
Therefore I want to import the wx library by using:

import wx

Running this line in a normal terminal is working fine. But running it in the grass terminal causes an error:

File “/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/init.py”, line 45, in
File “/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py”, line 4, in
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx/core.so, 2): Symbol not found: __ZN15wxPoint2DDouble14SetVectorAngleEe
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx/core.so
Expected in: /Applications/GRASS-6.4.app/Contents/MacOS/lib/libwx_macud-2.8.0.dylib

I’m working on Mac OS x with GRASS 6.4.0 RC5

Any ideas to solve this problem?


Tolle Neuerungen bei Hotmail - jetzt kennenlernen

If you're using my GRASS build, I bundle a newer copy of wxPython than is available in the system. Somehow this is getting confused, and it's trying to load wxPython from the system while still using the bundle wx libraries, which are incompatible.

Does the wxpython GUI run in GRASS? (I'm guessing no)

Are you doing something with the PYTHONPATH after starting GRASS? Or are you adding to PYTHONPATH in your shell init (.bash_profile, ...)?

On Jul 16, 2010, at 7:39 AM, Matthias Oswald wrote:

Hi list,

I'writing a python-script with a wx-gui (not in grass style) including some grass-commands.
Therefore I want to import the wx library by using:

import wx

Running this line in a normal terminal is working fine. But running it in the grass terminal causes an error:

  File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module>
  File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py", line 4, in <module>
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx/_core_.so, 2): Symbol not found: __ZN15wxPoint2DDouble14SetVectorAngleEe
  Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx/_core_.so
  Expected in: /Applications/GRASS-6.4.app/Contents/MacOS/lib/libwx_macud-2.8.0.dylib

I'm working on Mac OS x with GRASS 6.4.0 RC5

Any ideas to solve this problem?

Tolle Neuerungen bei Hotmail - jetzt kennenlernen _______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Mon Dieu! but they are all alike. Cheating, murdering, lying, fighting, and all for things that the beasts of the jungle would not deign to possess - money to purchase the effeminate pleasures of weaklings. And yet withal bound down by silly customs that make them slaves to their unhappy lot while firm in the belief that they be the lords of creation enjoying the only real pleasures of existence....

- the wisdom of Tarzan

William Kyngesburye wrote:

If you're using my GRASS build...,

Yes I'm using your GRASS build

William Kyngesburye wrote:

Does the wxpython GUI run in GRASS? (I'm guessing no)

The GRASS wxpython GUI is running.

William Kyngesburye wrote:

Are you doing something with the PYTHONPATH after starting GRASS? Or are
you adding to PYTHONPATH in your shell init (.bash_profile, ...)?

I just start GRASS without changing the PYTHONPATH...

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/import-wx-tp5301729p5302326.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Jul 16, 2010, at 10:03 AM, schorschli wrote:

William Kyngesburye wrote:

Does the wxpython GUI run in GRASS? (I'm guessing no)

The GRASS wxpython GUI is running.

William Kyngesburye wrote:

Are you doing something with the PYTHONPATH after starting GRASS? Or are
you adding to PYTHONPATH in your shell init (.bash_profile, ...)?

I just start GRASS without changing the PYTHONPATH...

Maybe something is getting inserted into the python path in some other way? Start python in GRASS, then

import sys
sys.path

You should see a bunch of frameworks at the front of the list, then etc/python from GRASS, then the system stuff. If there is another wx in the path before the GRASS etc/python, that will cause problems.

(Note, also try updating to GRASS 6.4rc6, though this might not help your problem. I tried rc6 and had no problems importing wx with various python startup methods. I don't have rc5 handy to try that.)

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole. Now what does that remind me of? Ah, yes - life."

- Marvin

Matthias Oswald wrote:

I'writing a python-script with a wx-gui (not in grass style) including
some grass-commands.Therefore I want to import the wx library by
using:

import wx

Apart from any other issues, the correct way to import wxPython is
e.g.:

  import wxversion
  wxversion.select('2.8')
  import wx

The "wx" module may not even be present in the search path until
wxversion.select() has been called.

Many systems add a symlink to a "default" version of wxPython for
backward compatibility with programs which pre-date the wxversion
module, but you shouldn't rely upon this either existing or referring
to the correct version.

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

Hi all,

While using GRASS 6.4.svn stable snapshot MS Windows
binaries GRASS6.4.0SVN-r42743-1 from

http://josef.fsv.cvut.cz/wingrass/grass64/ and
also with WinGRASS-6.4.0RC6-1

The following problems were reported by tester in Japan
using wxGUI both in Japanese and English language

1. Cannot erase a map in Map Display by unchecking the checkbox in
Layer Manager and re-rendering map.

2. Command "r.mfilter", "r.mapcalculator" and "r.colors.rules" are
activated only by typing them into Cmd>

3. Cannot erase a map in Map Display by unchecking the checkbox in
Layer Manager and re-rendering map.

4. Cannot run commands when I display any maps. Need to check
"menuform.py".

are others experiencing same issue? Any fix for the above
available?

Thanks in advance.

Venka

Venkatesh Raghavan:

Hi all,

While using GRASS 6.4.svn stable snapshot MS Windows
binaries GRASS6.4.0SVN-r42743-1 from

http://josef.fsv.cvut.cz/wingrass/grass64/ and
also with WinGRASS-6.4.0RC6-1

The following problems were reported by tester in Japan
using wxGUI both in Japanese and English language

1. Cannot erase a map in Map Display by unchecking the checkbox in
Layer Manager and re-rendering map.

That was platform-independent and true for all branches, now fixed.

2. Command "r.mfilter", "r.mapcalculator" and "r.colors.rules" are
activated only by typing them into Cmd>

It seems that r.mfilter is superseded by r.mfilter.fp?
AFAIK, "r.mapcalculator" and "r.colors.rules" are just graphical
front-ends for r.mapcalc and r.colors, respectively. In the wxGUI,
there is the new "Raster calculator" as graphical front-end for
r.mapcalc. The functionality of r.colors.rules is available in
r.colors (can't find r.colors.rules at all in grass64 on Linux)

4. Cannot run commands when I display any maps. Need to check
"menuform.py".

Weird. Works for me on Windows and Linux.

Markus M

Markus Metz wrote:

(can't find r.colors.rules at all in grass64

it's in gui/scripts/

Venkatesh Raghavan:

> 4. Cannot run commands when I display any maps. Need to check
> "menuform.py".

Weird. Works for me on Windows and Linux.

perhaps it is the d.* commands that are what do not work here?

Hamish

Markus Metz wrote:

> 2. Command "r.mfilter", "r.mapcalculator" and "r.colors.rules" are
> activated only by typing them into Cmd>

It seems that r.mfilter is superseded by r.mfilter.fp?

Yes. In 7.0, r.mfilter has been replaced by r.mfilter.fp. In 6.x,
r.mfilter is retained for compatibility (i.e. in case anyone has
scripts which rely upon the existing behaviour), but it's deprecated.

AFAIK, "r.mapcalculator" and "r.colors.rules" are just graphical
front-ends for r.mapcalc and r.colors, respectively.

Right. In 6.x, r.mapcalc doesn't use G_parser(), so it cannot generate
a parameter dialog. "r.colors ... color=rules" reads from stdin, which
won't work from the GUI (however, color=rules is deprecated in favour
of the rules= option, which reads rules from a named file).

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

On 2010/07/18 2:24, Glynn Clements wrote:
...

Right. In 6.x, r.mapcalc doesn't use G_parser(), so it cannot generate
a parameter dialog. "r.colors ... color=rules" reads from stdin, which
won't work from the GUI (however, color=rules is deprecated in favour
of the rules= option, which reads rules from a named file).

Will "r.mapcalculator" and "r.colors.rules" be retained as a GUI
menu option in the final GRASS-6.4 release. Perhaps they could be
removed to avoid confusing the users

Best

Venka

Venkatesh wrote:

Will "r.mapcalculator" and "r.colors.rules" be retained as
a GUI menu option in the final GRASS-6.4 release.

yes.

Perhaps they could be removed to avoid confusing the users

they should be mostly hidden to users by the GUI(s) and are still
needed for the default tcl/tk gis.m GUI.

regards,
Hamish

I updated to version GRASS 6.4rc6. But now I cannot start grass anymore...

File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1819, in <module>
    sys.exit(main())
  File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1812, in main
    app = GMApp(workspaceFile)
  File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1737, in __init__
    wx.App.__init__(self, False)
  File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 7978, in __init__
  File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 7552, in _BootstrapApp
  File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1748, in OnInit
    introBmp = introImage.ConvertToBitmap()
  File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 3369, in ConvertToBitmap
wx._core.PyAssertionError: C++ assertion "image.Ok()" failed at
../src/mac/carbon/bitmap.cpp(1286) in wxBitmap(): invalid image

William Kyngesburye wrote:

Maybe something is getting inserted into the python path in some other
way? Start python in GRASS, then

import sys
sys.path

You should see a bunch of frameworks at the front of the list, then
etc/python from GRASS, then the system stuff. If there is another wx in
the path before the GRASS etc/python, that will cause problems.

'/Users/lucaurbani/Documents/code/python_scripts/park_fahrtenberechnung'
'/Library/Frameworks/SQLite3.framework/Versions/3/Python'
'/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages'
'/Library/Frameworks/cairo.framework/Versions/1/Python'
'/Applications/GRASS-6.4.app/Contents/MacOS/etc/python'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages'
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload'
'/Library/Python/2.5/site-packages'
'/usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.5'
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC'

Any ideas what could be wrong (Maybe
'/usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.5')?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/import-wx-tp5301729p5315585.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Now the

import wx

command works but the grass wxgui not anymore...
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/import-wx-tp5301729p5315627.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Jul 20, 2010, at 2:39 AM, schorschli wrote:

I updated to version GRASS 6.4rc6. But now I cannot start grass anymore...

File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1819, in <module>
   sys.exit(main())
File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1812, in main
   app = GMApp(workspaceFile)
File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1737, in __init__
   wx.App.__init__(self, False)
File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 7978, in __init__
File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 7552, in _BootstrapApp
File "/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 1748, in OnInit
   introBmp = introImage.ConvertToBitmap()
File
"/Users/Shared/unix/wxpython-leo/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 3369, in ConvertToBitmap
wx._core.PyAssertionError: C++ assertion "image.Ok()" failed at
../src/mac/carbon/bitmap.cpp(1286) in wxBitmap(): invalid image

This has happened before in development versions. I thought I had it figured out as some combination of wxpython and image colorspace, but now I can't get it to work. It works on OS X Snow Leopard. The only difference there is Python 2.5 (Leopard) vs 2.6 (Snow). Using Python 2.6 on Leopard isn't practical.

I need to look into this...

'/Users/lucaurbani/Documents/code/python_scripts/park_fahrtenberechnung'
'/Library/Frameworks/SQLite3.framework/Versions/3/Python'
'/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages'
'/Library/Frameworks/cairo.framework/Versions/1/Python'
'/Applications/GRASS-6.4.app/Contents/MacOS/etc/python'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages'
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk'
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload'
'/Library/Python/2.5/site-packages'
'/usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.5'
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC'

Any ideas what could be wrong (Maybe
'/usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.5')?

GRASS path is before that, so it should not be a problem. From the error above, it's now using the embedded wxpython.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

[Trillian] What are you supposed to do WITH a maniacally depressed robot?

[Marvin] You think you have problems? What are you supposed to do if you ARE a maniacally depressed robot? No, don't try and answer, I'm 50,000 times more intelligent than you and even I don't know the answer...

- HitchHiker's Guide to the Galaxy