473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Python & Mayavi Problem

Hello NG,

I'm trying to follow the mayavi documentation in order to run
mayavi from python. In "Chapter 4. Using MayaVi from Python", there is
a simple example like this:

# generate the data.
from Numeric import *
import scipy
x = (arange(50.0)-25)/2.0
y = (arange(50.0)-25)/2.0
r = sqrt(x[:,NewAxis]**2+y**2)
z = 5.0*scipy.special.j0(r) # Bessel function of order 0
# now dump the data to a VTK file.
import pyvtk
# Flatten the 2D array data as per VTK's requirements.
z1 = reshape(transpose(z), (-1,))
point_data = pyvtk.PointData(pyvtk.Scalars(z1))
grid = pyvtk.StructuredPoints((50,50, 1), (-12.5, -12.5, 0), (0.5,
0.5, 1))
data = pyvtk.VtkData(grid, point_data)
data.tofile('test.vtk')

import mayavi
v = mayavi.mayavi() # create a MayaVi window.
d = v.open_vtk('test.vtk', config=0) # open the data file.
# The config option turns on/off showing a GUI control for the
data/filter/module.
# load the filters.
f = v.load_filter('WarpScalar', config=0)
n = v.load_filter('PolyDataNormals', 0)
n.fil.SetFeatureAngle (45) # configure the normals.
# Load the necessary modules.
m = v.load_module('SurfaceMap', 0)
a = v.load_module('Axes', 0)
a.axes.SetCornerOffset(0.0) # configure the axes module.
o = v.load_module('Outline', 0)
v.Render() # Re-render the scene.

Everything goes fine, but at the end I obtain the mayavi window
completely red (without the expected surface/image), and when I click
on this window I get different errors depending on which Python editor
I run:

1) Pythonwin: Error: Microsoft Visual C++ Runtime Error. Everything
Crashes. After this, I get a vtkwindow coming up and showing me the
"always-present" error message from mayavi:

"Generic Warning: In
/debian/stage/vtk-4.2.4/Rendering/vtkTkRenderWidget.cxx, line 638
A TkRenderWidget is being destroyed before it associated
vtkRenderWindow
is destroyed. This is very bad and usually due to the order in which
objects are being destroyed. Always destroy the vtkRenderWindow before
destroying the user interface components"

I don't know why, but with mayavi this warning is EXTREMELY common...

2) IDLE for Python: All is frozen, nothing happen, I have to kill
Python;
3) Python Command Line: No windows appears, nothing happen.

Moreover, I would like to be able to compile my Python application to
a standalone EXE file by using py2exe, but py2exe complains about some
missing modules (either from mayavi and for scipy), and the created
EXE does not start.
I have installed Python using the Enthought Installer for Python (with
lots of site-packages inside), located at:

http://www.enthought.com/python/

I'm running Win2000, without administrator privileges (if this can
make differences).

Does anyone have an idea?

Thanks for every suggestion.

Andrea.
Jul 18 '05 #1
0 1820

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Yi-Yu Chou | last post by:
Dear all, I want to use python as my GUI to load a 3D volume (vtkImageData), and use a pointer to pass this 3D image to my own C++ class. My question is I don't know how to communicate between...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
0
by: Emile van Sebille | last post by:
QOTW: "Oddly enough it is in Python that I have had the most fun programming. It is in Python that I find myself not only the most expressive but the most elegant in my programming. In Python my...
2
by: A. Novruzi | last post by:
Hi, I am looking for a free 3D visualization software, running in Linux, and able to visualize 3D functions in nonstructured mesh (basically, my mesh is a set of thetraheders used for some 3D FE...
1
by: Ron Kneusel | last post by:
I have installed VTK 4.2.6 and Python 2.3.4. Both are working and I can run the VTK Python examples except for those in the GUI directory. These always fail with messages similar to this: ...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
8
by: Georg Brandl | last post by:
Hello c.l.py, what features would you expect of a Python package manager, similar to CPAN or rubygems? I am currently planning to write such a thing, at first privately for myself, and if...
9
by: Carl | last post by:
I am desperately looking for a way to call Python from Matlab. I have become used to Python's rich syntax and large number of libraries, and feel ridiculously clumsy being stuck with Matlab's...
10
by: anton | last post by:
Hi, I would like to know if some of you knows a - working - actual - out of the box (for me: binaries available)
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.