Skip to content

Convert filename paths to POSIX format paths #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gadenbuie opened this issue Jan 17, 2025 · 0 comments · Fixed by #47
Closed

Convert filename paths to POSIX format paths #46

gadenbuie opened this issue Jan 17, 2025 · 0 comments · Fixed by #47
Assignees

Comments

@gadenbuie
Copy link
Contributor

gadenbuie commented Jan 17, 2025

@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"
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant