View Single Post
Old 06-23-2017, 08:24 AM   #37
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,495
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
In my case the "restart" calibre command always fails if I am not running from source.

@kovid: I replaced main.py with logging. Using the code:
Code:
                x = subprocess.Popen([e] + args)
                prints('after Popen:', x, file=open('c:/users/charles/log.txt', 'a'))
                time.sleep(3)
                x.poll()
                prints('after poll:', x.returncode, file=open('c:/users/charles/log.txt', 'a'))
I get after poll: '0' in the log which means that the subprocess terminated. I got the same answer with and without the sleep(3).

It occurred to me that the startup might be fast enough where the restarted calibre is seeing the original one and refusing to start. One difference between Home and Pro might be the order that windows runs new processes. To test this I changed main.py as follows:
- first discard all previous changes then:
Code:
def main(args=sys.argv):
    time.sleep(1)
    if iswindows and 'CALIBRE_REPAIR_CORRUPTED_DB' in os.environ:
        windows_repair()
        return 0
where the sleep(1) was arbitrary. Restart now works.
chaley is offline   Reply With Quote