You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I wrote an app in shiny express python, and its worked well in a local server on my computer. But when I try to install my app on a server, (with a docker image, and irequired python packages), I have an error that said:
Traceback (most recent call last):
File "/home/app/app.py", line 197, in <module>
@reactive.event(input.action_button)
File "/usr/local/lib/python3.10/site-packages/shiny/express/__init__.py", line 76, in __getattr__
raise RuntimeError(
RuntimeError: shiny.express.input can only be used inside of a Shiny Express app.
It seems to not accept the utilization of @reactive.event() in a shiny express application, but I saw in the documentation that the reactive module is unchanged between Core and Express. I don't understand the problem. Here the problematic part of my code:
from shiny import reactive
from shiny.express import input, render, ui
ui.panel_title("Exploration of Nanopore RNAseq results")
ui.input_text("gene_name", "Gene name Symbol", "Enter gene")
ui.input_action_button("action_button", "Search", disabled=False)
@render.text
@reactive.event(input.action_button)
def txt():
gene_conv=pl.read_csv("./data/geneToSymbol_GRCm38.99.csv", separator="\t", has_header = False)
if input.gene_name() in gene_conv['column_2']:
return f"The chosen gene is {input.gene_name()}"
else:
return f"The gene symbol is not in mm10 reference"
What's bug me is that worked perfectly fine on my computer with manual import of python packages.
I suppose I can always convert my code in Shiny Core python, but it will be a lot of works, I will gain a lot of time if It 's only a little mistake.
Can you help me?
The text was updated successfully, but these errors were encountered:
I ran your code in a devcontainer with Python 3.12.4 and Shiny, and it worked without any issues. This suggests the problem might not be with this snippet specifically, but rather with the overall structure of your code.
My test:
App.py
fromshinyimportreactivefromshiny.expressimportinput, render, uiui.panel_title("Exploration of Nanopore RNAseq results")
ui.input_text("gene_name", "Gene name Symbol", "Enter gene")
ui.input_action_button("action_button", "Search", disabled=False)
@render.text@reactive.event(input.action_button)deftxt():
#gene_conv=pl.read_csv("./data/geneToSymbol_GRCm38.99.csv", separator="\t", has_header = False)ifinput.gene_name() in ['ok', 'ok2']:
returnf"The chosen gene is {input.gene_name()}"else:
returnf"The gene symbol is not in mm10 reference"
Thank you for your answer,
I rewrite my code only in shiny core and its working. The problem can came from our installation on the server or from the python version used ( 3.10) I will investigate.
Hello
I wrote an app in shiny express python, and its worked well in a local server on my computer. But when I try to install my app on a server, (with a docker image, and irequired python packages), I have an error that said:
It seems to not accept the utilization of @reactive.event() in a shiny express application, but I saw in the documentation that the reactive module is unchanged between Core and Express. I don't understand the problem. Here the problematic part of my code:
What's bug me is that worked perfectly fine on my computer with manual import of python packages.
I suppose I can always convert my code in Shiny Core python, but it will be a lot of works, I will gain a lot of time if It 's only a little mistake.
Can you help me?
The text was updated successfully, but these errors were encountered: