panel
panel copied to clipboard
Panel Convert: SyntaxError: unterminated string literal
I'm on the current main branch of Panel trying to panel convert some apps at panel-chat-examples.
When I convert the below code example
"""
Demonstrates how to update the response of the `ChatInterface`.
"""
from asyncio import sleep
from random import choice
import panel as pn
pn.extension(design="material")
async def callback(contents: str, user: str, instance: pn.chat.ChatInterface):
yield "Let me flip the coin for you..."
await sleep(1)
characters = "/|\\_"
index = 0
for _ in range(0, 28):
index = (index + 1) % len(characters)
yield "\r" + characters[index]
await sleep(0.005)
result = choice(["heads", "tails"])
if result in contents.lower():
yield f"Woohoo, {result}! You win!"
else:
yield f"Aw, got {result}. Try again!"
chat_interface = pn.chat.ChatInterface(
widgets=[
pn.widgets.RadioButtonGroup(
options=["Heads!", "Tails!"], button_type="primary", button_style="outline"
)
],
callback=callback,
callback_user="Game Master",
)
chat_interface.send(
"Select heads or tails, then click send!", user="System", respond=False
)
chat_interface.servable()
panel convert feature_replace_response.py --to pyodide-worker
I get
SyntaxError: unterminated string literal (detected at line 29)
For now I will just add this app to the blacklist of apps we cannot convert.
feature_replace_response.html.csv feature_replace_response.js.csv
Futhermore I can see it also tries to install random with micropip.
Futhermore I can see it also tries to install random with micropip.
I wonder if this is a windows issue. I'll add some tests.
I think I mentioned this for the micropip reference. The sample works for me on Linux with a relatively current main!