Question

Hey, How can I get the current working directory of a VTE widget in Python? Thanks.

Was it helpful?

Solution

Borrowing from Mark, a slightly more elegant approach:

import vte
import os
v = vte.Terminal()
vPid = v.fork_command()
workingDir = os.readlink('/proc/%s/cwd' % vPid)

OTHER TIPS

This is a kludge, but the best way I can think of would be:

import vte
import os
v = vte.Terminal()
vPid = v.fork_command()
# make a system call to pwdx to get working director
sIn, sOut = os.popen2("pwdx " + vPid)
workingDir = sOut.read()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top