posit-dev / posit-dev/py-shinylive
shinylive::export() failure from presence of files with disallowed characters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 56
- Forks
- 6
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
I came across a cryptic shinylive::export() failure with a (to me) rather cryptic error message:
> shinylive::export(appdir = "../encoding", destdir = "docs")
Error in order(x, na.last = na.last, decreasing = decreasing, method = "radix") :
Character encoding must be UTF-8, Latin-1 or bytes
... that turned out to be due to the presence of a file within the project directory with a disallowed character.
Reproducing
- From
RStudiocreate a new Shiny Application project (default Old Faithful) - Confirm that
shinylive::export(appdir = "../encoding", destdir = "docs")andhttpuv::runStaticServer("docs")work fine - Within the project directory, create a directory called
• test(• is Option-8 on MacOS) shinylive::export(appdir = "../encoding", destdir = "docs")now fails with the above error- Delete the offending file -->
shinylive::export()now works again
I bring this up as an issue because the error message was very cryptic and the cause was hard to track down.
In my case, the offending file was in an • archive directory where I just kept scraps of reference materials, exploratory analysis, etc., which was not part of the app.
The directory has been present for a while and never caused problems before -- not sure at what point it became disallowed. I confirmed with peeky::peek_standalone_shinylive_app() that the offending directory wasn't included in previous versions of shinylive::export().
I spent a lot of time hunting through the actual app.R and other actual project files before I just created an empty project and added files to them one by one until the cause was determined. (And, since the folder was not even part of the code used, of course it was the last thing I tried.)
Suggestion
- Give a hint in the error message where to look (i.e., NOT in the actual app.R and other functional project files)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shinylive::export() failure with a directory named "• test" and trace how export scans project files before the encoding error occurs. The change is complete when the failure identifies the offending path or explains where to look, with coverage for the reported reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100