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

TypeError:unsupported operand type(s) for |: 'type' and 'NoneType' #18

Closed
alphacheng opened this issue Mar 26, 2024 · 2 comments
Closed

Comments

@alphacheng
Copy link

import pyvista as pv
import streamlit as st
from stpyvista import stpyvista

st.title("A cube")
st.info("""Code adapted from https://docs.pyvista.org/user-guide/jupyter/pythreejs.html#scalars-support""")

## Initialize a plotter object
plotter = pv.Plotter(window_size=[400,400])

## Create a mesh with a cube 
mesh = pv.Cube(center=(0,0,0))

## Add some scalar field associated to the mesh
mesh['myscalar'] = mesh.points[:, 2] * mesh.points[:, 0]

## Add mesh to the plotter
plotter.add_mesh(mesh, scalars='myscalar', cmap='bwr')

## Final touches
plotter.view_isometric()
plotter.background_color = 'white'

## Send to streamlit
stpyvista(plotter, key="pv_cube")

Any guidance on resolving this issue would be greatly appreciated :)
Additional Information:
python version: 3.9.13
pyvista version: 0.43.4
Streamlit version: 1.32.2
stpyvista version: 0.0.14
panel version: 0.13.1

@edsaac
Copy link
Owner

edsaac commented Mar 29, 2024

stpyvista 0.0.14 was tested for python>=3.10 only. Upgrading should take care of your issue. The other option is to upgrade stpyvista to version 0.0.16 where I fixed that type hint to work with python 3.9.

@alphacheng
Copy link
Author

Thank you for your reply. I will try it out

@edsaac edsaac closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants