Skip to content

Commit

Permalink
Run molecular visualization always if Ammolite is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed May 29, 2024
1 parent 9b87d44 commit f4fabd1
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions doc/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,20 @@ def pymol_scraper(block, block_vars, gallery_conf):
f"'{pymol_script_path}' file"
)

# If PyMOL image is already created, do not run PyMOL script,
# as this should not be required for building the documentation
if not isfile(pymol_image_path):
try:
import pymol
import ammolite
except ImportError:
# If Ammolite is not installed, fall back to the image file,
# if already existing
if not isfile(pymol_image_path):
raise ExtensionError("PyMOL or Ammolite is not installed")
else:
# Create a shallow copy,
# to avoid ading new variables to example script
# to avoid adding new variables to example script
script_globals = copy.copy(block_vars["example_globals"])
script_globals["__image_destination__"] = pymol_image_path

try:
import pymol
except ImportError:
raise ExtensionError("PyMOL is not installed")
try:
import ammolite
except ImportError:
raise ExtensionError("Ammolite is not installed")
with open(pymol_script_path, "r") as script:
# Prevent PyMOL from writing stuff (splash screen, etc.)
# to STDOUT or STDERR
Expand Down

0 comments on commit f4fabd1

Please sign in to comment.