I want to use Python to start gedit
(default gnome text editor) with a file already opened. I'm able to do so, but when called from Python gedit
will always open an extra tab named "Untitled Document 1" with some sort of rotating refresh icon.
I started with
subprocess.call(["gedit", pathToFile])
but this blocked the main process, so I'm now using
Popen(["gedit", pathToFile])
Both commands result in the same unwanted behaviour.
This does not happen if I call gedit from the command line like this:
gedit pathToFile
Is there anything I'm missing from the Python side of the problem?
Update: From the accepted answer I came up with this as a working solution:
Popen(["gedit", pathToFile], stdin=open(os.devnull, 'r'))
My guess would be that it's trying to read from standard input or somesuch.
Try adding stdin=open(os.devnull, 'r')
to the Popen
constructor.