Skip to content
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

Path("__file__").parent to read csv and pkl appears not to be working #174

Open
erikhall6373 opened this issue Sep 4, 2024 · 1 comment

Comments

@erikhall6373
Copy link

I had previously deployed to GitHub pages using this app,

https://github.com/erikhall6373/heisman/blob/4820a8d252ae87b939719236f4bde2497396434f/Shiny_App/app.py

However now it appears that the Path(file).parent or Path("file").parent trick does not work for me. Did recently change to using pd.read_pickle. Just wanted to point to a time in which app working reading in data.

@wch
Copy link
Collaborator

wch commented Sep 5, 2024

Using Path(__file__) should still work, as shown in this example: https://shinylive.io/py/examples/#read-local-csv

I've also tested locally with the shinylive python package 0.6.0, and running shinylive export works fine with the same files.

If you are running into the problem upon a redployment using a new version of shinylive, it's possible that it's due to some incompatibility in the pickled model object. I'm guessing it's from the statsmodels package?

A recent version of shinylive updated to Pyodide 0.26.2, which has Python 3.12.1, and it includes statsmodels version 0.14.2. If your pickle file was made with a different version of Python and/or statsmodels, then it might not load properly with the updated versions of Python and statsmodels. If that's the case, I suggest recreating the model with those versions of Python and statsmodels.

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

No branches or pull requests

2 participants