0

I am writing a code in python that opens the terminal, and goes to gnuplot. The problem is that after entering the gnuplot, the lines that follows the code aren't read, and so does nothing. What could i do in such way that the codes remain running, even after open the gnuplot?

import os
    os.system("gnuplot; p 'd.dat'")
    os.system(f"f(x) = a*cos(b*(x-c))+d")
    os.system(f"a = at")

As above shows, after the codes write gnuplot on the terminal, it opens the gnuplot and it stops to run. That is, it does not write. I would expect it writes p "d.dat" after opening the gnu terminal.

LSS
  • 127
  • 4
  • 1
    Does this answer your question? [Python subprocess module, how do I give input to the first of series of piped commands?](https://stackoverflow.com/questions/5080402/python-subprocess-module-how-do-i-give-input-to-the-first-of-series-of-piped-co) – Nick ODell Feb 19 '22 at 03:40
  • `os.system()` waits for end of `gnuplot` and later Python can run next `os.system()` which will run new process so it will be useless for you. – furas Feb 19 '22 at 05:14

0 Answers0