[Tutor] Fwd: open linux file browser from nuke python script

David Abbott david at pythontoo.com
Mon Jan 31 15:56:12 CET 2011


---------- Forwarded message ----------
From: David Abbott <david at pythontoo.com>
Date: Mon, Jan 31, 2011 at 9:55 AM
Subject: Re: [Tutor] open linux file browser from nuke python script
To: Pete O'Connell <pedrooconnell at gmail.com>


On Mon, Jan 31, 2011 at 6:42 AM, Pete O'Connell <pedrooconnell at gmail.com> wrote:
> Hi, I am trying to get a python script to open up a file browser window with
> the location of a folder. I am using kubuntu 10.04.
> The string that gets created works fine if I paste it into a shell eg:
> 'kde-open path/to/the/sequence',
> but it doesn't seem to want to run from within my interpreter using either
> subprocess.Popen or os.system
> For the first argument I have tried 'kde-open', 'konqueror', and a few
> others that all work fine in the shell but not in my interpreter.
> Here is what my script looks like:
> ####################################
> import nuke
> import subprocess
> def showFolder():
>     subprocess.Popen(['kde-open', 'path/to/the/sequence'])
> showFolder()
> ###################################################
> I must to run it from a specific interpreter (Nuke, the compositing
> software)
> Anyone have any idea what I might be doing wrong? Can anyone suggest a
> workaround?
> Pete
Here is one way this is just an example;
#!/usr/bin/python
from subprocess import call
def open_gedit():
       app = "gedit"
       fname = "test.txt"
       call([app, fname])
def main():
       open_gedit()
if __name__ == "__main__":
       main()



-- 
David Abbott (dabbott)
Gentoo
http://dev.gentoo.org/~dabbott/


More information about the Tutor mailing list