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

Atomic writes generate temp files in Dropbox #13041

Closed
1 task
rqli9 opened this issue Jun 16, 2020 · 16 comments · Fixed by #13915
Closed
1 task

Atomic writes generate temp files in Dropbox #13041

rqli9 opened this issue Jun 16, 2020 · 16 comments · Fixed by #13915

Comments

@rqli9
Copy link

rqli9 commented Jun 16, 2020

Issue Report Checklist

  • [ x] Searched the issues page for similar reports
  • [ x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [ x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • [ x] Tried basic troubleshooting (if a bug/error)
    • [x ] Restarted Spyder
    • [ x] Reset preferences with spyder --reset
    • [ x] Reinstalled the latest version of Anaconda
    • [ x] Tried the other applicable steps from the Troubleshooting Guide
  • [ x] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

Spyder4 changes the auto-save recovery file location to the last directory a script was opened from or saved to. Un-selecting the auto-save feature and restarting Spyder does not disable the auto-save file creation.

What steps reproduce the problem?

  1. Reset Spyder Settings
  2. Disable autosave, restart Spyder
  3. Open a previously saved script -- example.py, from directory "usr/pyscript/"
  4. Run the script, and find a list of "File" saved under the diretory "usr/pyscript/", where "File" are the different auto-save versions of example.py
  5. When ceating a new script, the default "save as" directory is also "usr/pyscript/"

What is the expected output? What do you see instead?

The autosave feature can be disabled correctly, or the autosave file to be saved in a specified directory.

Versions

  • Spyder version: 4.1.3
  • Python version: 3.7
  • Qt version:
  • PyQt version:
  • Operating System name/version:
@rqli9
Copy link
Author

rqli9 commented Jun 16, 2020

A new auto-save file pops up immediately after running any unsaved script with runcell (ctrl + enter).

By unchecking "save all files before running script" in the preferences, no new auto-save files are created at the time of running the cell. HOWEVER, new auto-save files are created in "usr/pyscript/" immediately when I manually save the changes to "example.py".

@steff456
Copy link
Member

Hi @rqli9,

Can you please send us a gif or screenshots of the behavior that you are having right now?

@rqli9
Copy link
Author

rqli9 commented Jun 17, 2020

Hi @steff456

I attached the screenshot of the auto-save files, which are variations of the versions of the highlighted ".py" file that I was actively working on and saved in the same folder. The "auto-save" feature was unselected before all these files were created. It seems to me that these files are the auto-saves for recovery purposes created by spyder.

pyspyder

@steff456
Copy link
Member

Spyder autosaves files in the configuration directory, so those files were not created by the program. Can you please delete all the temp files in the directory and verify if they are created once you open the NLTK_exercise.py in Spyder?

As well I can see in your screenshot that you are using Dropbox, so maybe that is the cause of all those temp files.

@rqli9
Copy link
Author

rqli9 commented Jun 18, 2020

Hello @steff456,

(1) I have manually checked all of these files. They contain incremental versions of NLTK_exercise.py

(2) After deleting all of the existing files, new files are added to the directory once I begin editing and running code in NLTK_exercise.py.

(3) I have been using Spyder3 in the same directory for an extended amount of time without issue. This problem disappears after reverting back to a Spyder3 installation and opening the NLTK_exercise.py file in the same directory. After going back to Spyder4, the problem appears again.

@steff456
Copy link
Member

steff456 commented Jun 18, 2020

It seems there's a conflict with the combination of the auto-save function with dropbox. For now, please work with your files outside dropbox while we work on fixing this.

Thanks for reporting!

@dalthviz can you please take a look on this one?

@rqli9
Copy link
Author

rqli9 commented Jun 18, 2020

@steff456

Thank you for working on this issue. I hope it will get fixed soon.

@ccordoba12
Copy link
Member

@dalthviz, I think this is related to the way we perform atomic writes and how Dropbox saves (somehow) those temporary files we use in the background.

@ccordoba12 ccordoba12 removed the v4.2.0 label Jun 27, 2020
@ccordoba12 ccordoba12 changed the title Spyder 4.1.3 Auto-Save does not function correctly Atomic writes generates temp files in Dropbox Jun 27, 2020
@ccordoba12 ccordoba12 changed the title Atomic writes generates temp files in Dropbox Atomic writes generate temp files in Dropbox Jun 27, 2020
@dalthviz dalthviz added this to the Sprint July milestone Jul 10, 2020
@ccordoba12 ccordoba12 modified the milestones: Sprint July, v4.2.0 Aug 9, 2020
@DominiqueMakowski
Copy link

I do confirm I have this annoying issue as well, are there any ways of preventing these files from being saved (I cannot avoid working in dropbox)?

@ccordoba12
Copy link
Member

Hey @DominiqueMakowski, there are no ways to avoid this problem right now, sorry.

@skjerns
Copy link
Contributor

skjerns commented Oct 2, 2020

I'm still affected by this issue, is this already being worked on?

I think this could be circumvented by not storing the tempfiles in the same directory (as long as it's on the same partition, this should be fine, right?), but in the tempfolder? or is there a reason why this is not done?

@dalthviz
Copy link
Member

dalthviz commented Oct 2, 2020

Hi @skjerns I think the idea you have is the right one 👍 In fact, I think is possible to change the dir where atomic-writes stores the temporary files by passing the dir kwarg (which is used in Atomic Writes to hold the temp files) with the path to the temp directory/a temp directory object here:

with atomic_write(absolute_filename, overwrite=True,
mode=mode) as textfile:

I haven had time to work on a fix for this but maybe you want to try to implement the fix @skjerns ? Let us know :)

@ccordoba12
Copy link
Member

ccordoba12 commented Oct 2, 2020

Good thinking @dalthviz! However, I would say that we should do that only if the directory you're trying to save to contains Dropbox in it. That's because it's the only directory our users have reported it gives problems with our atomic saving.

@skjerns
Copy link
Contributor

skjerns commented Oct 2, 2020

sure! I'll try that :)

And I'll also test it with other clients, such as NextCloud or OneDrive, as I would suspect that they could produce problems as well, however, as they are not so wide-spread it might not have been reported yet.

@dalthviz
Copy link
Member

dalthviz commented Oct 2, 2020

Thanks @skjerns !

@ccordoba12
Copy link
Member

Great! Thanks for your help @skjerns!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants