alternatively, you can also start your script (let's say you name it
'nukePythonScript.py') with a shebang:
>
> #!/Applications/Nuke6.3v4/Nuke6.3v4.app/Nuke6.3v4 -t
> import nuke
> print('hello')
> nuke.nodes.Blur()
> nuke.scriptSaveAs(filename= 'AnyLocationOnMyHD/scriptname.nk')
make sure it's executable: chmod 777 nukePythonScript.py
then just run like any other executable.
jrab
On Aug 2, 2012, at 10:39 PM, Julien Chandelle wrote:
> It's not really how it's work
>
> 1. you have to create a .py files with :
>
> import nuke
> print('hello')
> nuke.nodes.Blur()
> nuke.scriptSaveAs(filename= 'AnyLocationOnMyHD/scriptname.nk')
>
> in it
>
> 2. and after you call the file by a command line like that
>
> /Applications/Nuke6.3v4/Nuke6.3v4.app/Nuke6.3v4 -t yourFile.py
>
> and the script will be executed by nuke
>
>
> On Thu, Aug 2, 2012 at 10:00 PM, Wouter Gilsing <[email protected]>
> wrote:
> Hello,
>
> I'm trying to launch Nuke in Pythonmode from another script and give Nuke
> some code to execute (if possible I would give this commands in the external
> script as well). I'm using Mac OS 10.7, Nuke 6.3.4, Python 3.2 and Coderunner
> 2.1as my IDE. I came up with this:
>
> import os
> os.system('/Applications/Nuke6.3v4/Nuke6.3v4.app/Nuke6.3v4 -t')
> import nuke
> print('hello')
> nuke.nodes.Blur()
> nuke.scriptSaveAs(filename= 'AnyLocationOnMyHD/scriptname.nk')
>
> If I run this, only the first two lines will be executed. However, if I type
> the rest of the stuff directly in the console while running the code (well,
> the first two lines of my code) it works perfectly. But I don't want to type
> the rest of the code in the console, I want it to be executed when I run the
> script. I've a mistake somewhere cause Python stops reading all of my code
> after reaching the second line (it didn't even printed 'hello'). What am I
> dining wrong?
>
> Thanks in advance,
>
> Wouter
>
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
>
>
> --
> Julien Chandelle
> GSM : +32 (0) 494 277 542
> julienchandelle.be
> @jimbiscuit || imdb
> || Nuke , AE & Fusion Compositor ||
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python