View Single Post
Old 9th December 2017, 13:30   #11  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I'm using a portable Python. (Sorry, should have mentioned that.)
So setting the script path is probably needed.
Using:
Code:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()

scriptPath = 'h:/Output'
sys.path.append(os.path.abspath(scriptPath))

#import script A (h:/Output/scriptA.py)
import scriptA
original = vs.get_output()
#import script B (h:/Output/scriptB.py)
import scriptB
clip = vs.get_output()
# processing
if original.format.id != clip.format.id:
 original = core.resize.Bicubic(original, format=clip.format.id)
stacked = core.std.StackHorizontal([original,clip])
# Output
stacked.set_output()
I get:
Code:
Failed to evaluate the script:
Python exception: Plugin G:/Hybrid/vsfilters/SourceFilter/FFMS2/ffms2.dll already loaded (com.vapoursynth.ffms2)

Traceback (most recent call last):
  File "src\cython\vapoursynth.pyx", line 1830, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:36860)
  File "H:\Output\combined.vpy", line 14, in <module>
    import scriptB
  File "h:\Output\scriptB.py", line 5, in <module>
    core.std.LoadPlugin(path="G:/Hybrid/vsfilters/SourceFilter/FFMS2/ffms2.dll")
  File "src\cython\vapoursynth.pyx", line 1722, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:35000)
vapoursynth.Error: Plugin G:/Hybrid/vsfilters/SourceFilter/FFMS2/ffms2.dll already loaded (com.vapoursynth.ffms2)
Seems like the importing itself does work that way. Hurray!

Problem now is that both scripts use the same source filter (ffms2.dll) and thus the second script crashes on the LoadPlugin-line, since the Plugin is already loaded.

So:
  • Is there a way to check whether a plugin is already loaded ? (won't help here since I don't want to edit the two scripts, but it might be helpful when I generate scripts)
  • Might be a good idea if LoadPlugin would not cause a crash but instead simply ignore the second 'loading'-attempt.

Seems like currently import isn't the right way.

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 9th December 2017 at 13:34.
Selur is offline   Reply With Quote