Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error calling fusionless.Comp() from command line #5

Open
LarsCawley opened this issue Sep 11, 2016 · 1 comment
Open

error calling fusionless.Comp() from command line #5

LarsCawley opened this issue Sep 11, 2016 · 1 comment

Comments

@LarsCawley
Copy link

I'm having a bit of trouble getting going from the command line inside Fusion 8.2_b2, Python2.7

import fusionless as fu
c = fu.Comp()
Traceback (most recent call last):
  File "<nofile>", line 1, in <module>
  File "C:\Python27\lib\site-packages\fusionless-master\fusionless\core.py", line 62, in __new__
    "{0}".format(type(reference).__name__))
RuntimeError: No default reference for: NoneType
@BigRoy BigRoy closed this as completed in dd5724d Sep 12, 2016
@BigRoy
Copy link
Member

BigRoy commented Sep 12, 2016

I'm not entirely sure what Fusion is doing internally, but an interesting thing is going on in the console.

If you type:

print comp
# Composition (0x000000007C4F5FA0) [App: 'Fusion' on 127.0.0.1, UUID: 2152baa2-674c-4785-8a07-61980942ea53]

It will work as if it has that variable available. But it's not in locals or globals.

print locals().get("comp", None)
# None
print globals().get("comp", None)
# None

The interactive console session acts as the __main__ module, like a regular python process. Even that doesn't have the variable by default:

import sys
print getattr(sys.modules["__main__"], "comp", None)
# None

Nevertheless the "fusion" variable is accessible, so I added a fallback to get the currently active comp from the fusion variable.

Note that it is actually possible to overwrite the "fusion" and "comp" variables in the console. So even though we're currently mostly relying on getting the variables from __main__ it's not a completely secure solution. Keeping this open for now to investigate options later.

@BigRoy BigRoy reopened this Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants