PyWebIO
PyWebIO copied to clipboard
already in script mode
I am running my code but it shows already in script mode and fails to start server
It seems like that you use path_deploy()
to start pywebio server. Do you call any input or output functions of pywebio before path_deploy()
call? In Server mode, PyWebIO’s input and output functions can only be called in the context of task functions.
See also: https://pywebio.readthedocs.io/en/latest/guide.html#server-mode-and-script-mode
@wang0618
working on Google colab notebook faced same issue :
Another one :
SessionNotFoundException Traceback (most recent call last)
5 frames
/usr/local/lib/python3.7/dist-packages/pywebio/output.py in put_text(sep, inline, scope, position, *texts) 377 """ 378 content = sep.join(str(i) for i in texts) --> 379 spec = _get_output_spec('text', content=content, inline=inline, scope=scope, position=position) 380 return Output(spec) 381
/usr/local/lib/python3.7/dist-packages/pywebio/output.py in _get_output_spec(type, scope, position, **other_spec) 352 353 if not scope: --> 354 scope_name = get_scope() 355 else: 356 scope_name = scope
/usr/local/lib/python3.7/dist-packages/pywebio/output.py in get_scope(stack_idx) 292 """ 293 try: --> 294 return get_current_session().get_scope_name(stack_idx) 295 except IndexError: 296 logger.exception("Scope stack index error")
/usr/local/lib/python3.7/dist-packages/pywebio/session/init.py in get_current_session() 235 236 def get_current_session() -> "Session": --> 237 return get_session_implement().get_current_session() 238 239
/usr/local/lib/python3.7/dist-packages/pywebio/session/threadbased.py in get_current_session(cls) 303 def get_current_session(cls) -> "ScriptModeSession": 304 if cls.instance is None: --> 305 raise SessionNotFoundException("Can't find current session. It might be a bug.") 306 if cls.instance.closed(): 307 raise SessionClosedException()
SessionNotFoundException: Can't find current session. It might be a bug.
SessionNotFoundException: Can't find current session. It might be a bug.
@algopy PyWebIO don't support running in Google colab notebook
@wang0618 Can it be possible by using ngrok or local tunnel in colab? How to deploy pywebio app from heroku or azure cloud?