python - Redirect output to file after os.exec* -


i have python script, output piped log file. can restart file within os.exec call, if that, new process doesnt write output log file. how can keep output redirection after restarting process?

my script start:

python3.6 script.py >> home/pi/log/telegram_bot.log 2>&1 & 

my restart line:

import os import sys os.execv(sys.executable, [sys.executable] + sys.argv) 

i can't reproduce problem. here's first.py:

import os import sys os.execv(sys.executable, [sys.executable, "second.py"]) 

here's second.py:

print("hello") 

here's how run , check result. can see, works fine:

$ python first.py >> logfile 2>&1 & [1] 3098 $ wait $ cat logfile hello 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -