qmasingarbe / pymiere

Python for Premiere pro
GNU General Public License v3.0
363 stars 46 forks source link

demo_ui.py: Move selected by #19

Closed PFython closed 3 years ago

PFython commented 3 years ago

<class 'pymiere.core.ExtendScriptError'> TypeError at line 2 : Cannot set property start 1 try{ 2 var tmp = $._pymiere['GnoG4iISdP'].start = $._pymiere['X8s7RX0oh2']; 3 if(typeof tmp === 'object' && tmp !== null){ <traceback object at 0x0000020C1320F480> Traceback (most recent call last): File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\demo_ui.py", line 22, in wrapper result = func(self, *args, **kwargs) File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\demo_ui.py", line 179, in move_selected_func wrappers.move_clip(clip, seconds) File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\wrappers.py", line 134, in move_clip setattr(clip, param, time_object) File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\objects\premiere_objects.py", line 3787, in start self._eval_on_this_object("start = {}".format(_format_object_to_es(start)))
File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\core.py", line 163, in _eval_on_this_object result = _eval_script_returning_object(line) File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\core.py", line 425, in _eval_script_returning_object result = eval_script(script, decode_json=True) File "d:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\core.py", line 102, in eval_script raise ExtendScriptError(response_decoded) pymiere.core.ExtendScriptError: TypeError at line 2 : Cannot set property start 1 try{ 2 var tmp = $._pymiere['GnoG4iISdP'].start = $._pymiere['X8s7RX0oh2'];
3 if(typeof tmp === 'object' && tmp !== null){

qmasingarbe commented 3 years ago

This issue is the same as #13 , it should have been solved by https://github.com/qmasingarbe/pymiere/commit/45565bc75abb08b644a8e2a3cd02d5ebb873cf6d Can you confirm that ?

PFython commented 3 years ago

Hi Quentin - yes that seems to have solved #13 and #19 in simple projects but revealed another issue:

Track : Lower 3rd name Graphic Traceback (most recent call last): File "", line 1, in File "D:\Pete's Data\OneDrive\Python Scripts\pymiere\pymiere\wrappers.py", line 88, in list_video print("path", clip.projectItem.getMediaPath()) AttributeError: 'NoneType' object has no attribute 'getMediaPath'

I THINK this relates to the recently (2020) introduced "Essential Graphics" where you can create text and simple After Effects style elements directly in Premiere. They don't actually create a file and I believe they are just stored in memory as part of the .pproj file, which would explain why there's no value for MediaPath. Perhaps this can be fixed with simple error handling and giving it a default value of None (or the filename of the active .pproj file)?

PFython commented 3 years ago

or does this simple fix work?

print("path", str(clip.projectItem.getMediaPath()))

or:

print("path", clip.projectItem.getMediaPath() or pymiere.objects.app.project.name)

which will default to the .pproj filename if clip.projectItem.getMediaPath() is None

qmasingarbe commented 3 years ago

Thanks for the clue about the Essential Graphics, I implemented a fix in https://github.com/qmasingarbe/pymiere/commit/34db7d2a50c4a2a8ea11fe376c9fd9f2522aa658