I had topic here before but my problem is not solved...
I used an older version of Gnome for a very long time and my script worked very well. I have installed the latest version Gnome (3.36.9) and there is a small problem that does not interfere with the use of the program. I'm talking about an error:
Option “-e” is deprecated and might be removed in a later version of gnome-terminal. # Use “-- ” to terminate the options and put the command line to execute after it.
It doesn't stop me from using or running the program, but I wanted to get rid of the bugs in the console.
My older, working initial code looks like this:
# <--- CONFIG ---> #
os.chdir("/home/administrator/program/cartypes")
car1 = "audi"
color1 = "black"
engine = "diesel"
# <--- CONFIG ---> #
p1 = Popen(['gnome-terminal', '--wait', '-e','python3 ./program.py --car ' + car1 + ' --color ' + color1 + ' --engine ' + engine1])
time.sleep(5)
p1.communicate()
p1.wait()
print("End!")
I read a bit and changed "-e" to "--" that is:
p1 = Popen(['gnome-terminal', '--wait', '--','python3', './program.py'])
And theoretically the program starts, but unfortunately it doesn't work anymore when I add argparse to the code and I don't know how to connect working script with arguments send to program.py as that was before in first code with "-e":
p1 = Popen(['gnome-terminal', '--wait', '--','python3', './program.py'])
with:
./program.py --car ' + car1 + ' --color ' + color1 + ' --engine ' + engine1
Thanks! :)
Just get rid of the concatenation and make them separate list elements.
p1 = Popen(['gnome-terminal', '--wait', '--', 'python3', './program.py', '--car', car1, '--color', color1, '--engine', engine1])
Your original code also didn't quote or escape the variables, so you could run into problems if any of them contain quote characters.