enricofer / autosaver Goto Github PK
View Code? Open in Web Editor NEWauto save current project
auto save current project
Version 2.7 throws an error on autosave:
2023-05-22T08:21:42 WARNING Traceback (most recent call last): File "**/python/plugins\autoSaver\autosave.py", line 364, in cronEvent self.saveCurrentProject() File "**python/plugins\autoSaver\autosave.py", line 412, in saveCurrentProject del os.environ['QGIS_PLUGIN_AUTO_SAVING'] File "C:\PROGRA~1\QGIS32~1.4\apps\Python39\lib\os.py", line 695, in __delitem__ raise KeyError(key) from None KeyError: 'QGIS_PLUGIN_AUTO_SAVING'
Issue present on two versions of QGIS, 3.28.4 LTR and 3.30.2.
Hello,
There is an issue when the plugin try to inform the user that the save is successful in QGIS 3.34 :
self.iface.messageBar().pushMessage("Autosave", u"autosaved : "+layer.name(), level=qgis.gui.QgsMessageBar.SUCCESS, duration=3 ) AttributeError: type object 'QgsMessageBar' has no attribute 'SUCCESS'
Versions :
Python : 3.9.18 (heads/master:5eba59e, Feb 1 2024, 20:02:10) [MSC v.1929 64 bit (AMD64)]
QGIS : 3.34.3-Prizren Prizren, 47373234ac
I just updated the plugin to 2.5 and it's no longer functioning. macOS Monterey 12.0.1.
An error has occurred while executing Python code:
UnboundLocalError: local variable 'targetBakFile' referenced before assignment
Traceback (most recent call last):
File "/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/autoSaver/autosave.py", line 370, in cronEvent
self.saveCurrentProject()
File "/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/autoSaver/autosave.py", line 417, in saveCurrentProject
self.iface.messageBar().pushSuccess("Autosaver", u"project autosaved to: "+targetBakFile)
UnboundLocalError: local variable 'targetBakFile' referenced before assignment
Python version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)]
QGIS version: 3.16.14-Hannover Hannover, 4279198632
Python Path:
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/go2streetview/res
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/shapetools/ext-libs
/Users/userName/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/go2streetview
Much like how Office handles Autobackup files, I'd like to see this plugin set the "Hidden" system attribute (on Windows, will have to be handled differently on Linux/OSX) so that the directory doesn't get as cluttered with all the backups. If the user knows what they're doing sufficiently, they can restore them easily.
A simple CMD of "attrib +h *.bak*"
does the job to hide the backups. One can easily "attrib -h *.bak*"
to restore them.
Hi. I tried to install the autoSaver plugin in QGIS 2.14.1 on Windows 8.1 and I got the following error:
Couldn't load plugin autoSaver due to an error when calling its initGui() method
AttributeError: 'QCheckBox' object has no attribute 'setUnchecked'
Traceback (most recent call last):
File "C:/PROGRA1/QGISES1/apps/qgis/./python\qgis\utils.py", line 315, in startPlugin
plugins[packageName].initGui()
File "C:/Users/Guest/.qgis2/python/plugins\autoSaver\autosave.py", line 188, in initGui
self.initAutoSaver()
File "C:/Users/Guest/.qgis2/python/plugins\autoSaver\autosave.py", line 209, in initAutoSaver
self.dlg.enableSaveLayersBuffer.setUnchecked(True)
AttributeError: 'QCheckBox' object has no attribute 'setUnchecked'
Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS version: 2.14.1-Essen Essen, ea85bef
Python Path:
C:/Users/Guest/.qgis2/python/plugins\pktools
C:/PROGRA1/QGISES1/apps/qgis/./python/plugins\processing
C:/PROGRA1/QGISES1/apps/qgis/./python
C:/Users/Guest/.qgis2/python
C:/Users/Guest/.qgis2/python/plugins
C:/PROGRA1/QGISES1/apps/qgis/./python/plugins
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg
C:\PROGRA1\QGISES1\bin\python27.zip
C:\PROGRA1\QGISES1\apps\Python27\DLLs
C:\PROGRA1\QGISES1\apps\Python27\lib
C:\PROGRA1\QGISES1\apps\Python27\lib\plat-win
C:\PROGRA1\QGISES1\apps\Python27\lib\lib-tk
C:\PROGRA1\QGISES1\bin
C:\PROGRA1\QGISES1\apps\Python27
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\PIL
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\win32
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\win32\lib
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\Pythonwin
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\six-1.10.0-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
C:\PROGRA1\QGISES1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
C:/Users/Guest/.qgis2//python
C:\Users\Guest.qgis2\python\plugins\gearthview\ext-libs
C:\Users\Guest.qgis2\python\plugins
C:\Users\Guest.qgis2\python\plugins\QuickMultiAttributeEdit/forms
C:\PROGRA1\QGISES1\apps\qgis\python\plugins\fTools\tools
C:/Users/Public/Documents/amsantac/qgs
I stopped using this plugin when I realised that if I had a form open to edit feature attributes and autosaver did its thing, all the fields would be set to null. Disturbed to see this bear trap still lying around two years on, and now that I'm more savvy with GitHub I can raise it. You can avoid wiping the existing attributes permanently by clicking Cancel, but if you were nearly done putting a long description on a feature, that's a dead loss. Happens on every Windows 10 PC I've tried, QGIS versions 2 and 3.16.
Hi, this looks pretty good.
How do you use the backups? I couldn't see any instructions on restoring - removing the .bak doesn't work.
Many thanks
Sam
What do i need to do, autosaver doesn't work anymore. I get te next report. What is the argument wrtie() needs. I have no experience with python.
Er is een fout opgetreden bij het uitvoeren van Python code:
TypeError: write() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
File "C:/Users/khh/.qgis2/python/plugins\autoSaver\autosave.py", line 370, in cronEvent
self.saveCurrentProject()
File "C:/Users/khh/.qgis2/python/plugins\autoSaver\autosave.py", line 399, in saveCurrentProject
QgsProject.instance().write()
TypeError: write() takes exactly 2 arguments (1 given)
Python versie: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS versie: 2.18.17 Las Palmas, 98e769f70e
Python pad:
C:/PROGRA1/QGIS21.18/apps/qgis-ltr/./python/plugins\processing
C:/PROGRA1/QGIS21.18/apps/qgis-ltr/./python
C:/Users/khh/.qgis2/python
C:/Users/khh/.qgis2/python/plugins
C:/PROGRA1/QGIS21.18/apps/qgis-ltr/./python/plugins
C:\PROGRA1\QGIS21.18\bin\python27.zip
C:\PROGRA1\QGIS21.18\apps\Python27\DLLs
C:\PROGRA1\QGIS21.18\apps\Python27\lib
C:\PROGRA1\QGIS21.18\apps\Python27\lib\plat-win
C:\PROGRA1\QGIS21.18\apps\Python27\lib\lib-tk
C:\PROGRA1\QGIS21.18\bin
C:\PROGRA1\QGIS21.18\apps\Python27
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\win32
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\win32\lib
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\Pythonwin
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
C:\PROGRA1\QGIS21.18\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
C:/Users/khh/.qgis2//python
C:\Users\khh.qgis2\python\plugins\mmqgis/forms
C:/Users/khh/.qgis2/python/plugins\pdokservicesplugin
C:\Users\khh.qgis2\python\plugins\DigitizingTools\tools
C:\Users\khh.qgis2\python\plugins\FeatureGridCreator
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 213, in startPlugin
plugins[packageName].initGui()
File "/home/paolo/Desktop/qgis2_test/python/plugins/autoSaver/autosave.py", line 178, in initGui
self.initAutoSaver()
File "/home/paolo/Desktop/qgis2_test/python/plugins/autoSaver/autosave.py", line 192, in initAutoSaver
self.dlg.interval.setNum(10)
AttributeError: 'QLineEdit' object has no attribute 'setNum'
Dear enricofer!
I was adjusting the colors in the layer properties, in this moment the autoSaver plugin makes a backup
(i used to do this every 60 minutes) - I continue adjusting - suddenly QGis crashed
see bug report:
crash_autoSaverPlugin.txt
Priority LOW-maybe it helps you...
Thx - kind regards !!
Philipp
P.S.: very useful plugin !!
from [email protected]
Very useful plugin! However, when using "strange" scandinavian letters like æ, ø, å in the file names, Python throws an error.
Error:
An error has occured while executing Python code:
Traceback (most recent call last):
File "C:/Users/Kalle/.qgis2/python/plugins\autoSaver\autosave.py", line 299, in cronEvent
self.saveCurrentProject()
File "C:/Users/Kalle/.qgis2/python/plugins\autoSaver\autosave.py", line 319, in saveCurrentProject
print "project autosaved to: ",bakFileName
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 52: ordinal not in range(128)
Python version:
2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS version:
2.8.2-Wien Wien, 1b929ef
Is there an intention to support the qgz format ?
Since it has become the default format, I think it would prevent some confusion to many users.
It took me a while to figure out that this was the reason why I couldn't open my backup.
As a note to whoever fears having lost work :
Your .qgz.bak is not corrupted, you just have to rename the extension to .qgs instead of .qgz.
Hi Enrico, I have a query regarding your plugin.
Does the plugin create an actual backup of the individual shapefile layers in a project or only the project file itself?
Reason I ask is that I accidentally and carelessly saved edits made in error and as result, lost half a days work. So would this plugin “autosave the individual layers” into a seperate folder perhaps?
Si è verificato un errore durante l'esecuzione del codice Python:
AttributeError: type object 'QgsMessageBar' has no attribute 'SUCCESS'
Traceback (most recent call last):
File "C:/Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\autoSaver\autosave.py", line 366, in cronEvent
self.saveCurrentProject()
File "C:/Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\autoSaver\autosave.py", line 396, in saveCurrentProject
self.iface.messageBar().pushMessage("Autosave", u"project autosaved to: "+bakFileName, level=qgis.gui.QgsMessageBar.SUCCESS, duration=10 )
AttributeError: type object 'QgsMessageBar' has no attribute 'SUCCESS'
Versione Python: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
Versione di QGIS: 3.0.0-Girona Girona, 001c80b0c3
Percorso Python:
C:/OSGEO42/apps/qgis/./python2/apps/qgis/./python/plugins
C:/Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/OSGEO4
C:\OSGeo4W64\bin\python36.zip
C:\OSGEO42\apps\Python36\DLLs2\apps\Python36\lib
C:\OSGEO4
C:\OSGeo4W64\bin
C:\OSGEO42\apps\Python362\apps\Python36\lib\site-packages
C:\OSGEO4
C:/Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.