I have a simple python script test.py:
import time
import logging
logging.basicConfig(filename='app.log', filemode='w', level=logging.DEBUG)
i=0
while i<100:
i+=1
logging.info(i)
print(i)
time.sleep(1)
I want to run this script in background using anaconda. I tried :nohup python -u test.py &.
python keyword invokes anaconda on my machine. It seems that script is still linked to the terminal I used to run it. If I close the terminal, the execution stops and if I use 'exit' to close the terminal, the terminal turns black but doesn't close. If I close using 'X', the execution stops.
What is the correct way to trigger a python script to run on anaconda in background?
$ conda info
active environment : None
conda version : 4.9.2
conda-build version : 3.20.5
python version : 3.8.5.final.0
virtual packages : __win=0=0
__archspec=1=x86_64
base environment : F:\Automation\Anaconda3 (read only)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
platform : win-64
user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Windows/10 Windows/10.0.17763
administrator : False
netrc file : None
offline mode : False
Terminal used to run script: Git, version: 2.29.2.windows.3