How to restart octoprint in Windoze cleanly

What is the problem?
Safe mode when I start octoprint after an update, for example.

What did you already try to solve it?
I dont have a clue.

Logs (octoprint.log, serial.log or output on terminal tab at a minimum, browser error console if UI issue ... no logs, no support!)
I dont think the problem is so extensive that this needs to be provided.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)
win7
just upgraded from 1.3.12 to 1.4

Now what happens is I get SAFE mode, when I shutdown octoprint, and start it again.

As a result of above message I think my procedure for this is wrong, and need guidance on correct procedure.

Currently, I have no idea how to do a clean shutdown.
What I have been doing for all the years I have been using Octoprint in this win7 box, is to just kill the cmd box(big X), leaving the browser windows at 127.0.0.1:5000 open.
It usually moans that the server is offline

Double clicking the shortcut to start octoprint now causes the SAFE mode message.
127.0.0.1:5000 asks to RELOAD at this point.

What am I doing wrong.?

The Safe mode message does not happen every time I do the "restart" of octoprint, so
somewhat confused.

Please straighten me out.

If you please share logs, they come quite handy...

octoprint.log (202.3 KB)

All I am asking is how to RESTART octoprint in windows without SAFE mode appearing.

There is a reason it always starts in safe mode. It is to find out what it is and the logs can help.

So here is a error:

2020-04-02 09:07:55,654 - websocket - ERROR - error from callback <bound method TheSpaghettiDetectivePlugin.process_server_msg of <octoprint_thespaghettidetective_beta.TheSpaghettiDetectivePlugin object at 0x0406E170>>: process_server_msg() takes exactly 3 arguments (2 given)
2020-04-02 09:07:55,661 - websocket - ERROR - error from callback <bound method TheSpaghettiDetectivePlugin.process_server_msg of <octoprint_thespaghettidetective_beta.TheSpaghettiDetectivePlugin object at 0x0406E170>>: process_server_msg() takes exactly 3 arguments (2 given)

You may deactivate the spaghetti detective.

Also, clicking the close button is an effective approach to shutting down the OctoPrint instance. I personally use a batch script in the \OctoPrint\venv\Scripts\ folder named restart.bat with the following contents in it.

@if octoprint.==. (goto error) ELSE (goto restart)

:restart
@taskkill /f /im octoprint.exe >nul
@timeout /t 3 /nobreak >nul
@start octoprint.exe serve >nul
@echo restart complete
@goto exit

:error
@echo Oops... something went wrong!
@goto exit

:exit

Then in octoprint settings in the server section add the path to your batch file.

.

Ewald_Ikemann

You have put me in my place.
I bow to your correct analysis.

Issue is now gone.
And so is Spaghetti Detective.

1 Like

jneilliii

Thanks for the script.

This really completes things.

Nice and neat.

I can't take credit for this one. I found it somewhere here on the forum.

No worries. I had to learn it too.