Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bugs in demo trail.py? #15

Closed
Gjacquenot opened this issue Apr 18, 2019 · 4 comments
Closed

Possible bugs in demo trail.py? #15

Gjacquenot opened this issue Apr 18, 2019 · 4 comments
Labels

Comments

@Gjacquenot
Copy link
Contributor

Gjacquenot commented Apr 18, 2019

Hi @marcomusy,

I have tried to run demo trail with Python 3.5.2 and VTK 7.0 on MacOS with latest version 2019.1.4

I have encountered at least two problems

  • one coming from vtkplotter/shapes.py complaining about prefix f in front of formula string. Isn't it a r requested? I fixed it and could go further on.
  • a second one from an unknown method RenderPointsAsSpheresOn for vtkRenderingOpenGL2Python.vtkOpenGLProperty

The logs are presented below.

Here is the log of the 1st problem

from vtkplotter import Plotter, sin, Sphere, Point

## -- End pasted text --
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2963, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

File "<ipython-input-1-2aa1e2f83d5e>", line 1, in <module>
    from vtkplotter import Plotter, sin, Sphere, Point

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/__init__.py", line 51, in <module>
    from vtkplotter.plotter import *

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/plotter.py", line 14, in <module>
    import vtkplotter.addons as addons

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/addons.py", line 6, in <module>
    import vtkplotter.shapes as shapes

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/shapes.py", line 1464
    plt.text(0.5, 0.5, f'${formula}$',
                                    ^
SyntaxError: invalid syntax

Here is the log of the 2nd problem

from vtkplotter import Plotter, sin, Sphere, Point
 vp = Plotter(axes=6, interactive=0)
 s = Sphere(c="green", res=24)
 ## -- End pasted text --
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call last)
 <ipython-input-1-2aa1e2f83d5e> in <module>()
    4 vp = Plotter(axes=6, interactive=0)
    5 
 ----> 6 s = Sphere(c="green", res=24)
    7 s.cutWithPlane([-0.9, 0, 0], showcut=True)  # cut left part of sphere
    8 

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/shapes.py in Sphere(pos, r, c, alpha, res)
    697     ss.Update()
    698     pd = ss.GetOutput()
--> 699     actor = Actor(pd, c, alpha)
    700     actor.GetProperty().SetInterpolationToPhong()
    701     actor.SetPosition(pos)

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtkplotter/actors.py in __init__(self, poly, c, alpha, wire, bc, texture, computeNormals, u)
    541 
    542         if settings.renderPointsAsSpheres:
--> 543             prp.RenderPointsAsSpheresOn()
    544 
    545         if alpha is not None:

AttributeError: 'vtkRenderingOpenGL2Python.vtkOpenGLProperty' object has no attribute 'RenderPointsAsSpheresOn'
@marcomusy marcomusy added the bug label Apr 18, 2019
@marcomusy
Copy link
Owner

Thanks Guillaume for spotting these problems,
the RenderPointsAsSpheresOn indeed is only present in later vtk versions, so i will add a version check to that specific line.
for the moment you can comment out that line.

your python doesn't seem to support f-strings, probably a macOS issue (?) .. i need to investigate that..
cheers, marco

@Gjacquenot
Copy link
Contributor Author

  • f-strings were introduced in Python 3.6
  • RenderPointsAsSpheresOn is accessible from VTK 8.0

These two bugs can be fixed by updating setup.py:

  • delete support for Python2.7 and Python3.5
  • specify a version for VTK.

VTK is specified as a depency twice in the requirements.txt and in setup.py.
I would recommend to specify it once in requirements.txt and read the dependency from the setup.py

@marcomusy
Copy link
Owner

Yes- that makes sense, i will commit these changes along with others early next week, thanks.

@marcomusy
Copy link
Owner

Hi Guillaume
I added version.py so it's now picking it from a single source.
I would not drop python2 support for the moment as - i understand - it will be deprecated only by end of next year..
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants