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

Python Data Persistence #908

Closed
Gerzer opened this Issue Mar 6, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@Gerzer
Copy link

Gerzer commented Mar 6, 2019

Is there any way to store data in Python in a way that survives reboots? I’ve tried using the open() top-level function to create a text file, but it always returns None instead of a file-like object.

@Ecco

This comment has been minimized.

Copy link
Contributor

Ecco commented Mar 6, 2019

Hi @Gerzer ! No there is not, by design. What do you call reboots though? Do you mean a hard reset or leaving and entering the Python app again?

@boricj

This comment has been minimized.

Copy link
Contributor

boricj commented Mar 6, 2019

@Gerzer If you mean the Python interpreter state, it's destroyed whenever you exit the Python app. If you mean the Python scripts, they are stored in RAM and will be lost upon reset.

The NumWorks calculator doesn't have a general-purpose global datastore like the TI-83's VAT to store variables. It does have a global poincare context to store math things and a tiny "filesystem" to store Python scripts, but both are currently inaccessible from the Python interpreter.

@Gerzer

This comment has been minimized.

Copy link
Author

Gerzer commented Mar 6, 2019

Hi @Gerzer ! No there is not, by design. What do you call reboots though? Do you mean a hard reset or leaving and entering the Python app again?

@Ecco, I was referring to the act of pressing the power button twice to turn off the screen and to turn it back on again.

You said that this functionality is absent "by design". What do you mean? Why? This is definitely a feature that I would love to have.

To both you and @boricj, thanks for such a quick response, by the way! I just purchased the calculator a few days ago, and, overall, I'm impressed.

@Ecco

This comment has been minimized.

Copy link
Contributor

Ecco commented Mar 7, 2019

I was referring to the act of pressing the power button twice to turn off the screen and to turn it back on again.

Oh then, it's virtually transparent! Pressing the power button simply puts the device to sleep, and it resumes execution just where it left it.

So to keep Python data between power-button presses, just put it in a script or variable. Problem solved 😄

And thanks for the kind words by the way 😄

@Ecco Ecco closed this Mar 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.