[OLD] Hopefully this stops coming up in searches now

This post was about an older version of the script, which whilst it still pointed to the current version of the script contained outdated information.

My blog post about upgrading can be found here:

5 Likes

Hi,
just to let you know: everything seems to work for me, thank you!

1 Like

backup creation seems to fail.

Detected OctoPi installation
Checking version
OctoPrint version: 1.4.0

Creating a backup so we can read the plugin list
Traceback (most recent call last):
  File "upgrade.py", line 167, in <module>
    with zipfile.ZipFile('{}.zip'.format(backup_target), 'r') as zip_ref:
  File "/usr/lib/python3.7/zipfile.py", line 1204, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.octoprint/data/backup/octoprint-backup-20200629-075707.zip'



pi@octopi:~ $ cd /home/pi/.octoprint/data/backup/
pi@octopi:~/.octoprint/data/backup $ ls

octoprint-backup-20200625-093525.zip  octoprint-backup-20200629-075342.zip
pi@octopi:~/.octoprint/data/backup $

Hmm, strange. Can you do the following to test it out:

cd /home/pi/.octoprint/data/backup
source /home/pi/oprint/bin/activate
python -m octoprint plugins backup:backup --exclude timelapse --exclude uploads
ls

And see what happens there? OctoPrint outputs the name of the backup, which you should be able to see in the directory (using ls)
If not, let me know.

pi@octopi:~/.octoprint/data/backup $ cd /home/pi/.octoprint/data/backup/
pi@octopi:~/.octoprint/data/backup $ cd /home/pi/.octoprint/data/backup
pi@octopi:~/.octoprint/data/backup $ source /home/pi/oprint/bin/activate
(oprint) pi@octopi:~/.octoprint/data/backup $ python -m octoprint plugins backup:backup --exclude timelapse --exclude uploads
Initializing settings & plugin subsystem...
Creating backup at octoprint-backup-20200629-081625.zip, please wait...
Done.
(oprint) pi@octopi:~/.octoprint/data/backup $ ls
octoprint-backup-20200625-093525.zip  octoprint-backup-20200629-075342.zip  octoprint-backup-20200629-081625.zip

that worked fine, however... upgrade.py continues to fail

The backups are timestamped, does the timestamp make sense? It is supposed to delete the backups at the end, so that may be why it doesn't show in the ls afterwards. Will have to check.
Could you also let me know which version of the script it is (Shows up at the top).
Thanks

OctoPrint Upgrade from Python 2 to Python 3 (v1.3.2)

in the test that you asked me to perform, the backup was created correctly... octoprint-backup-20200629-081625.zip

At a slight loss here... Last thing is when it has the file not found error, is it looking for a backup with a timestamp that sounds right? Only thing I can think of is that the backup is not being created properly

the backup is never created by upgrade.py. although the diagnostic code snip you asked me to run does in fact create a backup.

this is the pertinent output from upgrade.py:

Creating a backup so we can read the plugin list
Traceback (most recent call last):
File "upgrade.py", line 167, in

Please try this version, it should print the backup output so we can verify if it works correctly.

curl https://raw.githubusercontent.com/cp2004/Octoprint-Upgrade-To-Py3/test-backup-forum/upgrade.py --ouput upgrade-test.py
python3 upgrade-test.py

Let me know what it says

python3 upgrade-test.py output :

Detected OctoPi installation
Checking version
OctoPrint version: 1.4.0

Creating a backup so we can read the plugin list
Initializing settings & plugin subsystem...

Creating backup at octoprint-backup-20200629-094052.zip, please wait...

Done.

Did the backup work?
[enter] to continue or ctrl-c to quit^CBye!
(oprint) pi@octopi:~ cd /home/pi/.octoprint/data/backup (oprint) pi@octopi:~/.octoprint/data/backup ls
octoprint-backup-20200625-093525.zip octoprint-backup-20200629-075342.zip octoprint-backup-20200629-081625.zip octoprint-backup-20200629-094052.zip
(oprint) pi@octopi:~/.octoprint/data/backup $ ^C

yes, octoprint-backup-20200629-094052.zip was created

Try continuing with that script then, not sure why it didn't work before.

Checking version
OctoPrint version: 1.4.0

Creating a backup so we can read the plugin list
Initializing settings & plugin subsystem...

Creating backup at octoprint-backup-20200629-094634.zip, please wait...

Done.

Did the backup work?
[enter] to continue or ctrl-c to quit
Traceback (most recent call last):
File "upgrade-test.py", line 187, in
octoprint_zip_name = re.search(r'(?<=Creating backup at )(.*)(?=.zip)', backup_output).group()
File "/usr/lib/python3.7/re.py", line 183, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

That'll be because I didn't change the code beyond that to use the new output instead..... Apologies, looking in to it. Still do not understand why the original script doesn't work.

Have updated the script, at the same place. May need to remove the old one, the version number should be 1.3.4
Haven't tested this version, will get on to that now.

Doesn't work, please wait...

Sorry for the spam........ Have fixed the script on the test-backup-forum branch for you. Fingers crossed it works, functionally nothing has changed from the original, now it is just displaying OctoPrint's backup output live. If it doesn't work, I think I have reached the end of the tunnel and can't fix your issue

this one worked. output:

It will install the latest OctoPrint (1.4.0) and all plugins.
No configuration or other files will be overwritten
Press [enter] to continue or ctrl-c to quit

Detected OctoPi installation
Checking version
OctoPrint version: 1.4.0

Creating a backup so we can read the plugin list
Initializing settings & plugin subsystem...

Creating backup at octoprint-backup-20200629-103142.zip, please wait...

Done.

Did the backup work?
[enter] to continue or ctrl-c to quit
Backup at /home/pi/.octoprint/data/backup/octoprint-backup-20200629-103142.zip
No plugins found
If you think this is an error, please ask for help. Note this doesn't include bundled plugins.
Press [enter] to continue, or ctrl-c to quit

Root access is required to install python3-dev, please fill in the password prompt if shown
Updating package list
[sudo] password for pi:
Installing python3-dev
Successfully installed python3-dev

Python 3 virtual environment created

Installing OctoPrint (This may take a while - Do not cancel!)
Downloading dependencies
Installing OctoPrint and its dependencies
Octoprint successfully installed

Starting OctoPrint

Cleaning Up...

Finished! Octoprint should be restarted and ready to go
Once you have verified the install works, you can safely remove the folder /home/pi/oprint.bak
If you want to go back (If it doesn't work) to Python 2 download the file at:
https://raw.githubusercontent.com/cp2004/Octoprint-Upgrade-To-Py3/master/go_back.py
pi@octopi:~ $

:+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1:
Never come across this one before. Was it a fresh install?

no not a fresh install, and always kept up-to-date.

Octoprint now reports in plugin manager:

Using pip of "/home/pi/oprint/bin/python", Version 20.1.1
Installation directory: /home/pi/oprint/lib/python3.7/site-packages ("--user" flag: no)
Virtual environment: yes

  • i'm assuming that's the desired result :slight_smile:
1 Like

Ok once I've cleaned up the changed code I'll look at pushing to the master branch. Thanks for your help with the diagnostics