Newbie Python, won't compile.. indent error?

Does this mean I screwed up an indent somewhere? .py attached. Anyone mind taking a look? Thank you!

Python encountered IndentationError(‘unexpected indent’, (’/opt/Autodesk/shared/python/mvp_exporters/’, 1, 1, ’ def get_media_panel_custom_ui_actions():\n’)) in unknown code
[PYTHON HOOK] An error occurred. Ignoring python hooks from /opt/Autodesk/shared/python/mvp_exporters/ (2.7 KB)

It looks like there’s a space before ‘def’ in line 1. Try removing that and see if it runs.

1 Like

Thanks. That was the first error…then I had to update the print to print(

Thanks @andymilkis !

Complete Noob here - not getting much truck with this .py to load a timeline setup - can anyone advise?

Syntax error everywhere:
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/Autodesk/presets/2022.3.1/shotgun/python/tk_flame_basic/…/tk_multi_pythonconsole/python/app/”, line 205, in execute
python_code = compile(python_script, “python input”, “exec”)
File “python input”, line 4
SyntaxError: invalid syntax (271 Bytes)

I can see two main problems in your script:

  1. The create_effect() function must be passed a valid Timeline FX as an argument. I am not sure what effect “UK_Legal” is supposed to be, especially since you are trying to load a Batch setup in it.

  2. In the documentation we represent an object between brackets like this but in your script you need to actually pass a real object, not this placeholder.

The easiest way to obtain a PySegment from the Python Console is to use flame.timeline.clip.selected_segments which will return a list of all the segments currently selected in the Timeline. You do not need to do this in a custom actions script since the selection is already passed.

Could you tell us what workflow you are trying to achieve? It would be easier for us to help you.

1 Like

Hi @fredwarren

As an experiment, I’m trying to load a gap batch fx in an empty timeline layer. It’s a legal title setup.

It is not possible to create a Batch FX or to “manipulate” it using the Python API so the approach you took won’t work.

The only thing similar that could work (but require more steps) would be to create a Timeline GAP BFX clip, keep it in your workspace, create a new track in the desired sequence and overwrite your Timeline GAP BFX clip on that track.

1 Like