Jump to: Board index » General » Fusion

bug? Python broken in 7.7.1?

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline
User avatar

Stefan Ihringer

  • Posts: 257
  • Joined: Mon Nov 10, 2014 10:40 pm

bug? Python broken in 7.7.1?

PostTue Apr 07, 2015 9:34 pm

Hi,

Python on the console does some unexpected things in 7.7.1...

Code: Select all
Py2> t=5
Py2> ==t
Traceback (most recent call last):
  File "<nofile>", line 1, in <module>
NameError: name 't' is not defined

can anybody confirm this?
blog and Fusion stuff: http://comp-fu.com/2012/06/fusion-script-macro-collection/
Offline
User avatar

Blazej Floch

  • Posts: 194
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: bug? Python broken in 7.7.1?

PostTue Apr 07, 2015 10:00 pm

No, I can not confirm this.
== is something that only works in eyeonscript and passes on to dump. This is not even Lua.
I am pretty sure this was documented on vfxpedia, and I am almost certain this is documented in the Generation scripting docs ;)

For python you always need to print or better print() = Python3.x ready.
However if you want all the pretty dump formatting use prettyprint:
Code: Select all
import pprint
pprint.pprint(comp.GetAttrs())


However THIS IS A BUG:
Code: Select all
from pprint import pprint
print(type(pprint))
<type 'module'> # No, it should import the function. Compare to a python console.

from pprint import pprint as pp
pp # Undefined
Offline
User avatar

Blazej Floch

  • Posts: 194
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: bug? Python broken in 7.7.1?

PostTue Apr 07, 2015 10:11 pm

Found another one, which is not really a show stopper but misbehaving anyways:
Code: Select all
from __future__ import print_function
print "Hello" # This is supposed to raise an Syntax Error
Hello

Please note that the import statement above is not a simple import but needs to set a flag on the interpreter. There are a few others, I guess the python scripting client does not respect these.
Offline
User avatar

Stefan Ihringer

  • Posts: 257
  • Joined: Mon Nov 10, 2014 10:40 pm

Re: bug? Python broken in 7.7.1?

PostWed Apr 08, 2015 10:48 am

Hi Blazej,

"==" was added to the Python console in Fusion 7. It works for stuff like "==comp.ActiveTool" but not in my example.
blog and Fusion stuff: http://comp-fu.com/2012/06/fusion-script-macro-collection/
Offline
User avatar

Blazej Floch

  • Posts: 194
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: bug? Python broken in 7.7.1?

PostWed Apr 08, 2015 10:22 pm

Thanks I did not know that.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 29 guests