Hi I've been struggling to sort out an issue with some of my thesis code for a couple of days. What I'm trying to do is run a python code within screen via a command in Putty via:
$ screen ./Top.py
Top.py is a dummy code I made to try and sort this out rather than waiting eight hours for the real code to hit the error. The issue that it encounters is that subprocess.call() it cannot begin new screens from a detached screen.
Contents of Top.py:
#!/usr/bin/env python
import time
import subprocess
time.sleep(10)
subprocess.call(["screen", "nohup", "./Call1.py", "&"])
subprocess.call(["screen", "nohup", "./Call2.py", "&"])
time.sleep(10)
There aren't any issues with the Call1.py and Call2.py, and the whole code runs smoothly if I never detach the screen. (But the full code will take a couple of days, so I can't leave it attached.) Another note is the nohup is just there so I can get the nohup.out file to for later reference, my actual code changes the directory they are located in so they don't overwrite each other.
I don't have any issues with not using screen to run the Call1 & Call2, but they need to run in parallel and in the background so the rest of my code can continue.