0

I know this question has been asked a lot but i have not really found a suitable solution for my problem. I have tried to implement

python myScript.py 2> errorlog.txt > logfile.txt

which also works but I don't want to run my code again since it should be implemented inside a GUI where when running it will execute some simulations and semi heavy calculations and I want the terminal output to be written/logged when you exit the GUI.

Hope someone can help me on my way.

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
  • Use the `script` command. – Barmar Apr 23 '21 at 18:56
  • Why is there terminal output if you have a GUI? – martineau Apr 23 '21 at 19:12
  • Im fairly new to this, what script command? well if any errors occur while running the code from the GUI they will be shown in the terminal. – Nicklas Koldkjær Apr 24 '21 at 15:14
  • 1
    IMO a GUI app shouldn't need a terminal (although you might want to use one while developing it). See the `errorwindow3k.py` module in my answer to the question [Display the output of the program on GUI with tkinter?](https://stackoverflow.com/questions/48977473/display-the-output-of-the-program-on-gui-with-tkinter). – martineau Apr 25 '21 at 14:12
  • 1
    Here's the [linux manual page](https://man7.org/linux/man-pages/man1/script.1.html) for the `script` command. – martineau Apr 25 '21 at 14:14
  • Thank you very much for the reply i will test that out. – Nicklas Koldkjær Apr 26 '21 at 06:22

0 Answers0