Overwrote a main program when i saved, is there a way to recover? (no b/u)

6,349 views
Skip to first unread message

dhf

unread,
Mar 9, 2014, 7:19:45 PM3/9/14
to spyd...@googlegroups.com
Hello,
I acceidently over wrote a file i was working on, which appreantly is not do hard to do in Spyder. Is there a way to recover?
Thanks
Dan

Adrian Klaver

unread,
Mar 9, 2014, 8:20:28 PM3/9/14
to spyd...@googlegroups.com
Is it not hard to overwrite a file in general. Not sure how Spyder
figures into this. So you will probably need to define in more detail
what you did?

Are you using version control?

Can you Ctrl-Z to undo?


> Thanks
> Dan
>
> --



--
Adrian Klaver
adrian...@gmail.com

dhf

unread,
Mar 10, 2014, 10:39:56 AM3/10/14
to spyd...@googlegroups.com


On Sunday, March 9, 2014 8:20:28 PM UTC-4, Adrian Klaver wrote:
On 03/09/2014 04:19 PM, dhf wrote:
> Hello,
> I acceidently over wrote a file i was working on, which appreantly is
> not do hard to do in Spyder. Is there a way to recover?

Is it not hard to overwrite a file in general. Not sure how Spyder
figures into this. So you will probably need to define in more detail
what you did?

Are you using version control?

Can you Ctrl-Z to undo?

I am such a new bee, i looked through the preferences and could not find where i set version control up? 

Thank you Adrian 

Adrian Klaver

unread,
Mar 10, 2014, 10:58:18 AM3/10/14
to spyd...@googlegroups.com
On 03/10/2014 07:39 AM, dhf wrote:
>
>
> On Sunday, March 9, 2014 8:20:28 PM UTC-4, Adrian Klaver wrote:
>
> On 03/09/2014 04:19 PM, dhf wrote:
> > Hello,
> > I acceidently over wrote a file i was working on, which
> appreantly is
> > not do hard to do in Spyder. Is there a way to recover?
>
> Is it not hard to overwrite a file in general. Not sure how Spyder
> figures into this. So you will probably need to define in more detail
> what you did?

Again, what exactly did you do to get into this state?

Knowing might help folks figure a way out.

>
> Are you using version control?
>
> Can you Ctrl-Z to undo?
>
>
> I am such a new bee, i looked through the preferences and could not find
> where i set version control up?

That would be set up independent of Spyder. In other words use Mercurial
or Git or something else to create a repository.

So for the sake of this problem, no you do not have version control set up.



>
> Thank you Adrian
>
>
>
> > Thanks
> > Dan
> >
> > --
>
>
>
> --
> Adrian Klaver
> adrian...@gmail.com <javascript:>
>

--
Adrian Klaver
adrian...@gmail.com

dhf

unread,
Mar 10, 2014, 11:06:36 AM3/10/14
to spyd...@googlegroups.com
yes, i understand...short of those, no way to recover i assume..right?

dhf

unread,
Mar 10, 2014, 11:17:29 AM3/10/14
to spyd...@googlegroups.com
I was working on two open/windows or panels - on one i had my main program in the other i hadall the related functions (python 2.7) when I saved my work, i guess i was in the wrong panel and cross-overwrote while saving my functions file on to the main code. I since recreated most of it. I can see how this can easily happen again. 

I just downloaded mercurial


On Sunday, March 9, 2014 8:20:28 PM UTC-4, Adrian Klaver wrote:

dhf

unread,
Mar 10, 2014, 11:40:40 AM3/10/14
to spyd...@googlegroups.com
I was working in two windows/panels  one had my main the other my functions, when it came time to save i saved the functions over the main...

i down loaded mercurial meanwhile


On Sunday, March 9, 2014 7:19:45 PM UTC-4, dhf wrote:

Adrian Klaver

unread,
Mar 10, 2014, 7:59:55 PM3/10/14
to spyd...@googlegroups.com
On 03/10/2014 08:17 AM, dhf wrote:
> I was working on two open/windows or panels - on one i had my main
> program in the other i hadall the related functions (python 2.7) when I
> saved my work, i guess i was in the wrong panel and cross-overwrote
> while saving my functions file on to the main code. I since recreated
> most of it. I can see how this can easily happen again.

I still don't see how this could happen in a normal save operation. Each
panel represents a separate file. If you just saved the file you where
in, it would save to itself not another file. Now if you did a Save As
then anything is possible, but that requires a conscious effort and is
something you can do in any program.

>
> I just downloaded mercurial
>
>



--
Adrian Klaver
adrian...@gmail.com

Hans Fangohr G

unread,
Mar 11, 2014, 7:54:46 AM3/11/14
to spyd...@googlegroups.com, Hans Fangohr
This is a common pattern I see when teaching beginners: in IDLE, for example, they edit the python file hello.py in the python file editor, and execute it in the python shell window. At some point, they want to explicitly save their file, and select ‘save' WHILE IN THE CONTEXT OF THE SHELL, and then save the log of commands and outputs from the shell into the file hello.py (at that point overwriting the actual code).

This seems completely implausible to be possible to those of us who have been in the business for some time, but in saying that we make (incorrectly) a huge number of assumptions about what people know.

I don’t know how this kind of data loss can easily be prevent; I certainly agree that - if what is outlined above was the case - this is nothing Spyder specific.

>>
>> I just downloaded mercurial

That’s one way of addressing this, and keeps saving my skin :)

Best wishes,

Hans


>>
>>
>
>
>
> --
> Adrian Klaver
> adrian...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups "spyder" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
> To post to this group, send email to spyd...@googlegroups.com.
> Visit this group at http://groups.google.com/group/spyderlib.
> For more options, visit https://groups.google.com/d/optout.

--
Hans Fangohr
Engineering and the Environment
University of Southampton
Phone: +44 (0) 238059 8345

Email: fan...@soton.ac.uk
http://www.soton.ac.uk/~fangohr
Twitter: @ProfCompMod





Roberto Rosati

unread,
Mar 11, 2014, 10:21:35 AM3/11/14
to spyd...@googlegroups.com
I think that your only chance is to try a third-party recovery software (i.e. an "undelete" software).

As was pointed out, that's not Spyder specific... some of the old word processor softwares used to rename the old file as ".bak" before saving to disk the new version of an existing file. I don't know how common this is nowadays though - and it only "saved" you from the last wrong save, unlike Version control.

Good luck!

Roberto

Adrian Klaver

unread,
Mar 11, 2014, 6:43:08 PM3/11/14
to spyd...@googlegroups.com, Hans Fangohr
On 03/11/2014 04:54 AM, Hans Fangohr G wrote:
>> On 03/10/2014 08:17 AM, dhf wrote:
>>> I was working on two open/windows or panels - on one i had my main
>>> program in the other i hadall the related functions (python 2.7) when I
>>> saved my work, i guess i was in the wrong panel and cross-overwrote
>>> while saving my functions file on to the main code. I since recreated
>>> most of it. I can see how this can easily happen again.
>>
>> I still don't see how this could happen in a normal save operation. Each panel represents a separate file. If you just saved the file you where in, it would save to itself not another file. Now if you did a Save As then anything is possible, but that requires a conscious effort and is something you can do in any program.
>>
>
> This is a common pattern I see when teaching beginners: in IDLE, for example, they edit the python file hello.py in the python file editor, and execute it in the python shell window. At some point, they want to explicitly save their file, and select 'save' WHILE IN THE CONTEXT OF THE SHELL, and then save the log of commands and outputs from the shell into the file hello.py (at that point overwriting the actual code).

I see what you are saying, I just could not replicate this in Spyder. If
I had a file with unsaved changes in the editor and invoked Save while I
was in a console it saved the changes in the file only, it did not
overwrite it with the console contents. If there where no unsaved
changes in the file editor the only choice I had was Save As. Invoking
that opened a file dialog where it is possible to pick an existing file.
Doing so though threw up a warning dialog that I was about to overwrite
an existing file. So I guess it could be done but you would have to work
at it.


>
> This seems completely implausible to be possible to those of us who have been in the business for some time, but in saying that we make (incorrectly) a huge number of assumptions about what people know.
>
> I don't know how this kind of data loss can easily be prevent; I certainly agree that - if what is outlined above was the case - this is nothing Spyder specific.
>
>>>
>>> I just downloaded mercurial
>
> That's one way of addressing this, and keeps saving my skin :)

Agreed, though I should have mentioned when I made the version control
suggestion, that regular backups are important also. Version control is
only as good as the last commit. You make a bunch of changes off a
commit and then have an oops you are back to rebuilding from the last
commit. Having something that is backing up the files regularly is
extra insurance.

>
> Best wishes,
>
> Hans
>
>
>>>
>>>
>>
>>
>>
>> --
>> Adrian Klaver
>> adrian...@gmail.com
>>


--
Adrian Klaver
adrian...@gmail.com

Joseph Martinot-Lagarde

unread,
Mar 13, 2014, 8:44:49 PM3/13/14
to spyd...@googlegroups.com
There was a bug in spyder when using a separate subwindow for the editor. The file would be saved in the wrong file. It has been corrected one year ago.

http://code.google.com/p/spyderlib/issues/detail?id=1269&can=1&q=file%20save%20status%3DFixed&colspec=ID%20MS%20Stars%20Priority%20Modified%20Cat%20Type%20Status%20Owner%20Summary

Mayur Modi

unread,
Apr 10, 2019, 9:15:09 AM4/10/19
to spyder
C:\Users\<username>\.spyder-py3\history.py
Reply all
Reply to author
Forward
0 new messages