Domanda

hey, Come posso ottenere l'attuale directory di lavoro di un widget VTE in Python? Grazie.

È stato utile?

Soluzione

Prenotare dal marchio, un approccio leggermente più elegante:

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

Altri suggerimenti

Questo è un kling, ma il modo migliore che riesco a pensare sarebbe:

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()
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top