Reputation: 597
I am rendering 3D surfaces. My program used to work but somewhere an update seems to have gone wrong.
Using python3 if I execute
from mayavi import mlab
this responds with
File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object
Line 209 is return _compile(pattern, flags).sub(repl, string, count) So "count" is an integer and the function "sub" expects a string and gives a type error.
I tried blindly changing count to str(count) which didn't work.
How can I restore mayavi.mlab to something that doesn't crash?
Upvotes: 0
Views: 92
Reputation: 597
There is some error in "/usr/lib/python3.10/re.py"
The troublesome line is line 209
return _compile(pattern, flags).sub(repl, string, count)
A little debugging shows this happens when the variable string is type None
If the following code line is added prior to line 209 then the import works.
if string==None: return("")
Testing mayavi on an import file, rendering an image works.
This fix needs to be treated with considerable suspicion because the curative code was deduced through trial and error guesswork with no real understanding of what is going on. For those just wanting to get the import mayavi.mlab going this will help and eventually a proper repair will be released with mayavi updates.
Upvotes: 0