Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion textworld/render/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@


from textworld.render.render import load_state, load_state_from_game_state, visualize
from textworld.render.serve import get_html_template
2 changes: 1 addition & 1 deletion textworld/render/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ def visualize(world: Union[Game, State, GlulxGameState, World],
"""
try:
import webbrowser
from textworld.render.serve import get_html_template
except ImportError:
raise ImportError('Visualization dependencies not installed. Try running `pip install textworld[vis]`')

Expand All @@ -369,7 +370,6 @@ def visualize(world: Union[Game, State, GlulxGameState, World],

state["command"] = ""
state["history"] = ""
from textworld.render.serve import get_html_template
html = get_html_template(game_state=json.dumps(state))
tmpdir = maybe_mkdir(pjoin(tempfile.gettempdir(), "textworld"))
fh, filename = tempfile.mkstemp(suffix=".html", dir=tmpdir, text=True)
Expand Down