I probably should have been more clear in my initial response. The bug (feature request?) I reported was that, even after passing the '--' flag (which should "end switches"), numeric arguments are still eaten.

My desired functionality would be that numeric arguments are preserved if they occur after a '--' flag.

Sorry for the confusion.

-Nathan

-----Original Message----- From: Hugo Léveillé
Sent: Friday, April 27, 2012 5:01 AM
To: Nuke Python discussion
Subject: Re: [Nuke-python] nuke -t argv problem

Hey Nathan

Here's what I got from support. Seems like an intended feature.

=============================
Hello Hugo,

Thanks for contacting the Foundry Support.

The behaviour you have reported is actually an intended design in Nuke,
that
is the integer numbers at the end are treated like a frame range.

If you wish to access all the args that are passed to Nuke, you can do
so with
"nuke.rawArgs".

Try executing a .py file with the following contents using the -t flag,
which
should illustrate the difference:

=====
import sys
import nuke
print sys.argv
print len(sys.argv)

print nuke.rawArgs
print len(nuke.rawArgs)
=====

Please give it a go and let me know, how you get on. Please do let me
know if
you have any further comments or queries.

Kind regards,
========================================


















On Wed, Apr 25, 2012, at 11:01, Nathan Rusch wrote:
Yes, this is a bug, logged as #17918. Give it a support bump if you'd
like.

One workaround is to quote the integer argument with a leading or
trailing
space:

/vg/apps/Nuke/Nuke6.3v6/Nuke6.3 -t
"/home/VGMTL/hleveille/Desktop/arg_test.py" hello world "5 "

-Nathan


-----Original Message----- From: Hugo Léveillé
Sent: Wednesday, April 25, 2012 10:52 AM
To: PYTHON (nuke) discussion
Subject: [Nuke-python] nuke -t argv problem

Is this a bug ? You cannot end an argument list with an int when using
nuke -t ?

ex:

make a .py file that looks like this:

======
import sys
import nuke
print sys.argv
print len(sys.argv)
=======

Then execute the file with the nuke -t interpreter

/vg/apps/Nuke/Nuke6.3v6/Nuke6.3 -t
"/home/VGMTL/hleveille/Desktop/arg_test.py" hello world
['/home/VGMTL/hleveille/Desktop/arg_test.py', 'hello', 'world']
3

This is fine and working as expected
======================================
Now try this:

/vg/apps/Nuke/Nuke6.3v6/Nuke6.3 -t
"/home/VGMTL/hleveille/Desktop/arg_test.py" hello world 5
['/home/VGMTL/hleveille/Desktop/arg_test.py', 'hello', 'world']
3

The 5 at the end is ignored.


======================
/vg/apps/Nuke/Nuke6.3v6/Nuke6.3 -t
"/home/VGMTL/hleveille/Desktop/arg_test.py" hello world 1 bar
['/home/VGMTL/hleveille/Desktop/arg_test.py', 'hello', 'world', '1',
'bar']
5

Its working again since its no longer a int at the end

Is it a bug or indented by design ?


--
  Hugo Léveillé
  TD Compositing, Vision Globale
  [email protected]

_______________________________________________
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


--
 Hugo Léveillé
 TD Compositing, Vision Globale
 [email protected]

_______________________________________________
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

Reply via email to