qmasingarbe / pymiere

Python for Premiere pro
GNU General Public License v3.0
367 stars 48 forks source link

createBin() - missing 1 required positional argument: 'name' #60

Closed black-syphilis closed 1 year ago

black-syphilis commented 1 year ago

Hi,

I try to create bin in my project

import pymiere from pymiere.core import from pymiere.exe_utils import from pymiere.wrappers import from pymiere.objects.premiere_objects import from pymiere.objects.start_vars import *

ProjectItem.createBin("Create New Bin")

But I have this error Traceback (most recent call last): File "Z:\DAPControls\Trash\python\Projets\pyPremiere\pyProjet.py", line 49, in ProjectItem.createBin("Create New Bin") TypeError: ProjectItem.createBin() missing 1 required positional argument: 'name'

Any idea ?

qmasingarbe commented 1 year ago

Hi @black-syphilis , createBin() is not a classmethod, you have to have an instance of ProjectItem to act on it. Overall this is not the way you want to use pymiere, you have to start from one of the top level entry point (probably the project), then you will have access to the objects on which you may act.

In your case, this code should do what you want:

project = pymiere.objects.app.project  # get current project
my_bin = project.rootItem.createBin("HelloWorld")  # create a new bin under the root bin of the project
print(my_bin.name)

If you want more example, please see the documentation