I run a python program from the CLI of Ubuntu and I start it with python3 programname.py and pause it with CTRL Z and restart it with fg. Is it possible to restart it from a certain line number after it has been paused. eg something like type in fg line 324 to restart the paused program from line 324 and not the line it paused at. A solution from within the python code would also be useful if not possible from the Ubuntu Command Line
1 Answers
The Ubuntu CLI doesn't know about the code you're running because you are running it in the python interpreter. Therefore, if you wanted to enable python to pause your code and continue it at a certain line, you would have to work with the code. As for restarting your code at a certain line, I don't think that would yield good results for you. The reasons are that you would skip execution of any code between where you paused and where you resumed so any declarations or statements between those points would not be executed. Given that, your code would likely break unless you had designed it intentionally with this functionality in mind. Even then, you would have to work directly with the python interpreter to make it happen.
If you want to try and debug your code, I'd suggest looking at this.

- 7,252
- 5
- 40
- 90