shiny app shows error code 1 but works fine in my local page

I looked up to log of my app and it shows this. I don't know why its error show. Crying!!
The picture is the error.

Thank you so much!

When you deploy your app to, it runs on their servers, not in your local system, so you can't (and shouldn't anyways) set the working directory to a location in your own file system.

There is no need to use setwd() on a shiny app, the app's root directory is the base for all relative paths on run time. Just remove that command from your code.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue. Have a look at these resources, to see how to create one for a shiny app

1 Like

Hi, Andre, thank you for your reply!
I put my reprex code here including other files, I am hoping to use several python functions in my shiny app and get the return value of them. This python file is just a small test and my actual python file is a large file with many functions.

The python file is named

def su(x, y):
    return x + y

def sub(x, y):
    return x - y

The R reprex file is here and the python path I used is an absolute path for my computer

path_py = "C:\\Users\\18337\\Desktop\\testapp\\"

ui = dashboardPage(
  #(1) Header
  dashboardHeader(title=tags$h1("Test-App",style="font-size: 120%; font-weight: bold; color: white"),
                  titleWidth = 350,
                  tags$li(class = "dropdown"),
                  dropdownMenu(type = "notifications", icon = icon("question-circle", "fa-1x"), badgeStatus = NULL,
                               tags$li(a(href = "",
                                         target = "_blank",
                                         tagAppendAttributes(icon("icon-circle"), class = "info"),
                                         "Created by"))
  #(2) Sidebar
    numericInput("n1", "First number:", 1, min = 1, max = 100),
    numericInput("n2", "Second number:", 1, min = 1, max = 100),
    tags$p("Upload the image here.")
  #(3) Body
    tags$br(),tags$p("1. Type in one number"),
    tags$p("2. Type in the next number."),
      column(h4("Add Value:"),textOutput("output_value1"), width=6),
      column(h4("Substract Value:"),textOutput("output_value2"), width=6)

server = function(input, output){
  output$output_value1 = renderText({
    su(input$n1, input$n2)
  output$output_value2 = renderText({
    sub(input$n1, input$n2)

shinyApp(ui, server)

This is definitely not going to work on because of the reasons I already explained, you need to deploy that file along with your shiny app (within the same root folder) and use a relatively path instead.

Also, if you are importing any python package in your code, you need to explicitly install those using reticulate at the beginning of your code but have in mind that they might not be supported on

Thank you!! I understand and my app works!
I tried the relative path before but I didn't deploy the python file.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.