Comments (5)
The original code causing the problem is here (mayavi/tools/modules.py:72):
def _line_width_changed(self):
try:
self._target.actor.property.line_width = self.line_width
except AttributeError:
try:
self._target.property.line_width = self.line_width
except AttributeError:
pass
It turns out that when "line_width" is not an attribute of whatever object is actor.property or _target.property, a TraitError is thrown (for at least some items) and not an AttributeError, which is what would be handled by the exception handlers above. TraitError is defined in another package called traits, which is in a separate folder to mayavi. I have modified my local copy of modules.py:72 to look like this:
def _line_width_changed(self):
if hasattr(self._target, 'actor') and \
hasattr(self._target.actor, 'property') and \
hasattr(self._target.actor.property, 'line_width'):
self._target.actor.property.line_width = self.line_width
elif hasattr(self._target, 'property') and \
hasattr(self._target.property, 'line_width'):
self._target.property.line_width = self.line_width
Basically, I am explicitly testing for the presence of the desired attributes. I have nowhere near enough knowledge about the mayavi codebase to know whether this is the right way to approach this problem or not. Adding an import (from traits.api import TraitError) and adding TraitError to the exception handlers in the original code feels icky to me.
from mayavi.
I'm having the same problem.
from mayavi.
A also have this problem, my environment Windows 7, python(x,y) distribution.
Thank you for your patch, it solve this problem in my environment!
from mayavi.
Same here on Mac OS X 10.8.4, with MacPorts Python 2.7.6, py27-mayavi @4.2.0_1
. The proposed patch fixes the error, in my case triggered when running the pick_on_surface.py
example.
from mayavi.
Fixed with #96.
from mayavi.
Related Issues (20)
- zsh: segmentation fault python3.11 examples/mayavi/advanced_visualization/mlab_3D_to_2D.py
- AttributeError: 'int' object has no attribute 'ogrid' when running mayavi/examples/mayavi/advanced_visualization/numeric_source.py
- AttributeError: 'NoneType' object has no attribute 'to_array' when running mayavi/examples/mayavi/data_interaction/normal_flipping_stl.py HOT 1
- ModuleNotFoundError: No module named 'traitsui.qt4.editor' when running mayavi/examples/mayavi/interactive/lorenz_ui.py HOT 2
- AttributeError: module 'tvtk.tools.visual' has no attribute 'color' when running mayavi/examples/mayavi/interactive/mlab_visual.py
- AttributeError: 'OrientationMarkerWidget' object has no attribute 'set_viewport' when running mayavi/examples/mayavi/interactive/subclassing_mayavi_application.py
- NameError: name 'file' is not defined. Did you mean: 'filter'? when running mayavi/examples/mayavi/mlab/chemistry.py HOT 1
- TypeError: 'float' object cannot be interpreted as an integer when running mayavi/examples/mayavi/mlab/simple_structured_grid.py
- AttributeError: 'NoneType' object has no attribute 'interpreter' when running mayavi/examples/tvtk/scene.py
- segmentation fault python3.11 mayavi/examples/tvtk/ivtk_example.py when running mayavi/examples/tvtk/ivtk_example.py
- traits.trait_errors.TraitError: Cannot set the undefined 'magnification' attribute of a 'WindowToImageFilter' object. when running mayavi/examples/tvtk/off_screen.py
- ERR| vtkJPEGReader (0x7ff593fd0230): Unable to open file images/masonry.jpg happend when running mayavi/examples/tvtk/texture_glyph.py
- TypeError: order must be str, not bool when running mayavi/examples/tvtk/visual/bounce.py
- ImportError: cannot import name 'float' from 'numpy' when running mayavi/examples/tvtk/visual/wave.py
- The pipeline is not displaying HOT 1
- Mesh control for volumetric data HOT 1
- Barchart: Separate scales for X- and Y
- ModuleNotFoundError: No module named 'traitsui.qt4' And ModuleNotFoundError: No module named 'pyface.ui.null' HOT 5
- pip install mayavi build fails HOT 4
- examples/mayavi/interactive/coil_design_application.py fails: No module named 'traitsui.qt4.editor' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mayavi.