Skip to content

Convert filename paths to POSIX format paths #46

Closed
@gadenbuie

Description

@gadenbuie

@gadenbuie the error showed in the previous comment seems to be an issue related to how the app.json it's created in Windows. In windows \\ is added instead of / in the name field:

Image

Replacing \\ with / in the app.json fix the issue of deploying shinylive python apps in windows

Thanks to @DrEntropy who figured this out

Originally posted by @davidrsch in #1768

Example app.json included in the linked issue:

[
  {
    "name": "app.py",
     "content": "from shiny import App, ui\nfrom modules.counter_module import counter_ui, counter_server\n\n# Main app UI\napp_ui = ui.page_fluid(\n    ui.h2(\"Demonstration of Shiny Modules\"),\n    ui.row(\n        ui.column(6,\n            ui.card(\n                \"Counter 1 (increments by 1)\",\n                counter_ui(\"counter1\", increment=1)\n            )\n        ),\n        ui.column(6,\n            ui.card(\n                \"Counter 2 (increments by 10)\",\n                counter_ui(\"counter2\", increment=10)\n            )\n        )\n    )\n)\n\n# Main app server\ndef server(input, output, session):\n    # Initialize counter modules with different configurations\n    counter_server(\"counter1\", increment=1)\n    counter_server(\"counter2\", increment=10)\n\napp = App(app_ui, server)", 
     "type": "text"
  },
  {
     "name": "modules\\__init__.py",
     "content": "",
     "type": "text"
  },
  {
     "name": "modules\\counter_module.py",
     "content": "from shiny import ui, module, render, reactive\n\n# Module UI function\n@module.ui\ndef counter_ui(increment):\n     # Create namespace for IDs\n    return ui.div(\n        ui.input_action_button(\"button\", f\"Add {increment}\"),\n        ui.output_text(\"value\"),\n        ui.tags.br(),\n        ui.output_text(\"total_clicks\")\n    )\n\n# Module server function\n@module.server\ndef counter_server(input, output, session, increment):\n    @reactive.calc\n    def count():\n        return input.button() * increment\n\n    @output\n    @render.text\n    def value():\n        return f\"Current value: {count()}\"\n    \n    @output\n    @render.text\n    def total_clicks():\n        return f\"Number of clicks: {input.button()}\"",
     "type": "text"
  }
]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions