0

I started a Python code one week ago and it continues running now. The program finds some values and adds them to the list. Like this:

list = []
for i in range(len(ytun)):
   a = x+5
   list.add(a)

and end of the code the list element will be saved in txt file.

I realized it would be too long . My question is how can I stop it without losing the values I added to the list. I don't want to lose one week process. Thank you.

Random Davis
  • 6,662
  • 4
  • 14
  • 24
Easycoder
  • 1
  • 1
  • 1
    Are you running the script in a debugger? Otherwise it seems like you'd have to somehow attach a debugger to your running script, then introspect/print out the values in `list`. Do you have any experience with debuggers? If not I recommend researching how to attach a debugger to a running Python script. Also, as an unrelated side note, you shouldn't call something `list` in Python, since that shadows a built-in name. – Random Davis Mar 19 '21 at 18:15
  • [Here](https://stackoverflow.com/questions/25308847/attaching-a-process-with-pdb/41574422) is a related question about debugging a running process, see if that helps. If all else fails you'll have to introspect the process's memory and get the values out that way, but if you have no experience with something like that then it'd probably take a while to learn how. – Random Davis Mar 19 '21 at 18:16
  • Thank you for answering. I will research debugging. I use sublime text, can I debug with sublime text? – Easycoder Mar 19 '21 at 18:39
  • According to [this answer](https://stackoverflow.com/questions/29064081/run-python-debugger-pdb-in-sublime-text-3), while you can do it in Sublime, it's not recommended. – Random Davis Mar 19 '21 at 18:49

0 Answers0