xywust2014
xywust2014

Reputation: 3

A monitor scale change was detected

I run a program for 4 days using Spyder (3.10). The results are done and I want to save the final output data. However, I encountered an pop-up screen that "A monitor scale change was detected. We recommend restarting Spyder to ensure that it is properly displayed. If you don't want to do that, please be sure to activate the option". I couldn't close this pop-up screen. The only way to close this is to click on the Restart now. My question is that after my program finishes, is there anyway that I could access my final result variable from the anaconda prompt or somewhere else? As long as I could have access to this final result variable, I am good. I am afraid that I will lose my variables from here since I have deadlines.

I tried searching google, but I couldn't find an answer.

Upvotes: 0

Views: 99

Answers (1)

nekomatic
nekomatic

Reputation: 6284

If you are really using Spyder 3.10, that's a very old version - the current version at the time of writing is 5.5.0. Maybe you actually mean you are using Python 3.10 in some version of Spyder.

If you don't find a fix for the Spyder issue, you can run your Python script from a command prompt or terminal with:

python -i myscript.py

The -i flag means that when your script finishes, you get a Python prompt and any variables and functions defined by your script will still be present, so you can explore them interactively.

A better solution though would be to have your script save your results when it's finished, so you can retrieve them any time you want. The simplest way to do that is with pickle:

import pickle

# your code goes here and produces a result in the variable my_data

with open("filename.pkl", "wb") as f:
    pickle.dump(my_data, f)

Then you can load the data back into another Python session to work with it again:

with open("filename.pkl", "rb") as f:
    my_data = pickle.load(f)

Upvotes: 0

Related Questions