Spyder crashed but I didn't saved the code I was working on. When I restarted Spyder, obviously my code was gone. I found out, that I somehow can get the code back with the command hist -g. I have tried this, but this only allows me to see statements like this: runfile('XXXX', wdir='XXX')
Is there a way to get my code back? Despite of one other question on stackoverflow i couldnt find anything related to my problem.
[Sorry if I understood something completly wrong or if I have grammar- or spellingerros. This is my first coding internship and English is not my native language, I'll try to improve both in the future :)]
Related
Spyder crashed at the last minute and I had force quit the programme as it wasn't responding at all. After reopening it, I am not able to find my file that I was working on, i hadn't saved it and had quite a bit of code written in it. It will be a huge help if someone knows a way to recover it, and can guide me through it.
Thanks alot!
hist -g will show console history logs. You can recover your code from history if you had run your code earlier.
I experienced a similar situation where I had added code to existing script that later wasn't saved as I expected it to be. I was able to recover my code from the history log (copy and paste). Not a perfect solution, but much better than having to re-write the code.
I am on Spyder 3.3.4
I'll comment to help in case (someone crazy like me) clicked the discard button when Spyder asked if you wanted to restore the file.
I found the following solution:
open a new terminal
cd /home/pc/.config/spyder-py3/
code .
open the history.py file
Heart attack stopped successfully!
Anyway, you will no longer find the file you discarded in the autosave folder, however, in the history.py file are saved the last 1000 lines that you executed, in my case the last 30 were enough.
I hope it helps
Just for the people who still want to know the solution, close and open again Spyder application. It will ask you to recover the file. This worked for me today.
Go to C:\path.spyder-py3
You will have directories with the name autosave, you can find your autosaved files here. These are same ones that come up when you close and open spyder. It loads it from this autosave dir.
Another method is to check the history.py file which stores commands run in spyder console. However, there is a limit to this history. The old ones will get deleted.
I'm trying to run an automated test in Ride.py. This test works on my colleague's computer but for some reason does not work on mine. The test starts but at a certain point i get the following error:
[ ERROR ] Calling method 'start_keyword' of listener 'C:\Python27\lib\site-packages\robotide\contrib\testrunner\TestRunnerAgent.py' failed: IndexError: list index out of range
The interesting part is that this error occurs on the same spot ever time, but with a different test it happens at a different time.
I tried to google several things and nothing worked. One solution suggested there was a '#' commented somewhere and this caused the crash. I looked but I don't see a '#' commented anywhere.
Another suggestion lead me to believe my testrunneragent.py file must have been installed wrong. I went online to find the file and replaced it. This did not work either (reran the test before and after a restart of ride)
We tried to re-import the test files thinking perhaps something went wrong there. This did not help either.
Googling juts the last part (IndexError: list index out of range) gave me the suggestion it does not recognize all the lines of code in the back-end file. I would have no clue how to solve this as im not a major coder.
One difference between me and my colleague could be the versions. I downloaded python version 2.7.16 and ride 1.7.3.1. My colleague uses an older version of both python and RIDE. Perhaps the problem could be here?
https://paste.fedoraproject.org/paste/TLekH3az0m4wuUyM8C2RYw
I expect the test will run without failing (it is a happy flow) I have included some screenshots with code in the previous segment that might help
downgraded to the same version of Ride.py
This seems to have fixed the issue
just started working on my quiz application using python and it has to do with maths(True-False) questions.So whenever i try to copy-paste a question from the internet to my questions array some characters are really messed up.Can anyone help me solve this please? i have searched a lot for a solution but didn't get an answer so far.(I am using Pycharm)
Sometimes there are space/tab conversion errors that occur when copy/pasting from a web source.
If that is the problem you're having in pycharm, just highlight the code that was copied > Edit > Convert Indents.
If this is not what you needed, please edit your question to include the code block containing the "really messed up characters" that you are seeing in pycharm. I'll try to see what's happening there.
I don't know how this happens or why,
but I'll be in a jupyter notebook grouping by things and I will very conciously type in dataframe.groupby, write some other code and hit ctrl+ enter
and there will be that damn error. Every single time, I will go back and delete the 'groupyouby' and type in groupby.
I doubt that anyone has run into this error,and I don't know how long it will be until someone else creates the mess of libraries that I have that resulted in this chinese water tourture like nightmare. I am here, to let you know, that you are not alone.
Also if someone has a fix that would be great. I got nothing for you other than that description above.
Grammarly was the cause of this.
If you use jupyter notebooks and have the grammarly extension. It will cause problems.
So I'm working on a problem for my programming course "6.00.1x Introduction to Computer Science and Programming Using Python", and I've now run into some issues.
I'd gotten very close to the solution for the problem, but my answer was a little off. I went in and started making changes to the code. But as I pressed run (I'm using Spyder), the Ipython console gave me the exact same answer as before. I grew a little suspicious and started removing large chunks of code. Still the same answer. At the end I'd removed so much code that I only had a few completely irrelevant lines left and there was absolutely no way it should work. Yet it did, even after changing the input, it did exactly what it had done earlier.
Now, I'm a total beginner so I bet I've just missed something, but I'd really appreciate it if someone could explain to me what's going on.
annualInterestRate = 0.2
monthlyint = annualInterestRate/12
balance = 320000
epsilon = 0.5
print(round(guess,2))
According to what I've learnt this code shouldn't work (the round variable for example isn't even defined), and makes pretty much no sense. However, when I input it into the console it gives me:
29591.88
Why the heck does this happen?
Here's a picture of it in my console.
(Spyder developer here) To avoid this kind of problem we added (since Spyder 3.1) a new option to clear all variables present in an IPython console before running a file.
To access that option you need to go to the menu
Run > Configure
(if you want to apply to the file you're running) or to
Tools > Preferences > Run
(if you want to apply it to all your files), then look for
General settings
and select
[ ] Clear all variables before execution (IPython consoles)