473,698 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.speci al.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(transpo se(z), (-1,))
point_data = pyvtk.PointData (pyvtk.Scalars( z1))
grid = pyvtk.Structure dPoints((50,50, 1), (-12.5, -12.5, 0), (0.5,
0.5, 1))
data = pyvtk.VtkData(g rid, point_data)
data.tofile('te st.vtk')

import mayavi
v = mayavi.mayavi() # create a MayaVi window.
d = v.open_vtk('tes t.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.SetFeatur eAngle (45) # configure the normals.
# Load the necessary modules.
m = v.load_module(' SurfaceMap', 0)
a = v.load_module(' Axes', 0)
a.axes.SetCorne rOffset(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/vtkTkRenderWidg et.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 1858

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

Similar topics

3
3143
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 python and C++. Any suggestion would be appreciated. _________________________________________________________________ ²{¦b´N¤W MSN ¥xÆWºô¯¸¡G»P¿ËªB¦n¤Íºò±KÁpô¡A§Y®É´x´¤·s»D¡B°]¸g¡B®T¼Öªº³Ì·s°T ®§ http://msn.com.tw
699
33941
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
0
1564
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 code is the clearest and most concise. I don't for one instant feel constrained by Python. I feel liberated by it." -- Steve Lamb "After a few hours with Python, I was already better at object-oriented Python than I ever was at...
2
2532
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 computations). Can anyone confirm that indeed MayaVi can visualize 3D functions in nonstructured mesh? I went through the manuals but I didn't find that MayVi can do so.
1
2571
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: /home/rkneusel/VTK/Examples/GUI/Python> python2.3 BoxWidget.py Traceback (most recent call last): File "BoxWidget.py", line 57, in ? boxWidget = vtk.vtkBoxWidget() AttributeError: 'module' object has no attribute 'vtkBoxWidget'
114
9842
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
2068
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 it's proving useful, I think about releasing it. I plan to model it after gentoo's portage, with less features of course. Would this be acceptable?
9
5287
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 rather restricted facilities for doing other things than standard mathematical work. Does anyone know of good techniques (or readily available software) for achieving a cross-language support between Python and Matlab? Carl
10
2758
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
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.