AttributeError: 'libpanda.MovieVideoCursor'

Greetings All,
I’ve tried running the attached code as well as some examples found at code.google.com/p/video-puzzle/
All give me the following error:
AttributeError: ‘libpanda.MovieVideoCursor’ object has no attribute ‘fetchIntoTexture’

[*]Running Panda3d 1.8.1 with Vista SP2 64bit on portable(integrated webcam)

Code

from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from panda3d.vision import *
class Application(ShowBase):
	def __init__(self):
		ShowBase.__init__(self)
		for i in range(WebcamVideo.getNumOptions()):
			print WebcamVideo.getOption(i)
		if WebcamVideo.getNumOptions() > 0:
			opt = WebcamVideo.getOption(0)
			self.cursor = opt.open()
			self.tex = Texture()
			self.cursor.setupTexture(self.tex)
			cm = CardMaker("plane")
			cm.setFrame(-1, 1, -1, 1)
			plane = render2d.attachNewNode(cm.generate())
			plane.setTexture(self.tex)
			scaleX = float(self.cursor.sizeX()) / float(self.tex.getXSize())
			scaleY = float(self.cursor.sizeY()) / float(self.tex.getYSize())
			plane.setTexScale(TextureStage.getDefault(),
			Vec2(scaleX, scaleY))
			taskMgr.add(self.update, "update video")
	def update(self, task):
		if self.cursor.ready():
			self.cursor.fetchIntoTexture(0, self.tex, 0)
		return task.cont

w = Application()
run()

Output

Known pipe types:
	wglGraphicsPipe
(all display modules loaded.)
Added device: DirectShow: 0264A184:2
Added device: DirectShow: 0264A244:2
Added device: DirectShow: 0264A304:2
Added device: DirectShow: 0264A3C4:2
Added device: DirectShow: 0264A484:2
Added device: DirectShow: 0264A544:2
Added device: DirectShow: 0264A604:2
Added device: DirectShow: 0264A6C4:2
Added device: DirectShow: 0569CA34:2
Added device: DirectShow: 0569CAF4:2
Laptop Integrated Webcam: 640x480 @ 30Hz
Laptop Integrated Webcam: 1600x1200 @ 10Hz
Laptop Integrated Webcam: 1280x1024 @ 10Hz
Laptop Integrated Webcam: 1024x768 @ 10Hz
Laptop Integrated Webcam: 800x600 @ 30Hz
Laptop Integrated Webcam: 352x288 @ 30Hz
Laptop Integrated Webcam: 320x240 @ 30Hz
Laptop Integrated Webcam: 176x144 @ 30Hz
Laptop Integrated Webcam: 160x120 @ 30Hz
Live! Cam Virtual: 160x120 @ -2147483648Hz
	IID_IGraphBuilder & IID_ICaptureGraphBuilder2 are established.
	IID_IMediaControl interface is acquired.
	The capture filter is acquired.
	The capture filter has been added to the graph.
	IID_IBaseFilter of CLSID_SampleGrabber is acquired.
	The media type of the sample grabber is set 24-bit RGB.
	The sample grabber has been added to the graph.
	IID_IBaseFilter of CLSID_NullRenderer is acquired.
	The Null Renderer has been added to the graph.
Connected media type 640 x 480
Traceback (most recent call last):
	File "cam.py", line 25, in update
		self.cursor.fetchIntoTexture(0, self.tex, 0)
AttributeError: 'libpanda.MovieVideoCursor' object has no attribute 'fetchIntoTexture'
:task(error): Exception occured in PythonTask update video
Trackback (most recent call last):
	File "cam.py", line 29, in <module>
		run()
	File "C:\Panda3D-18.1\direct\showbase\ShowBase.py", line 2921, in run self.taskMgr.run()
	File "C:\Panda3D-18.1\direct\task\Task.py", line 502, in run self.step()
	File "C:\Panda3D-18.1\direct\task\Task.py", line 460, in step self.mgr.poll()
	File "cam.py", line 25, in update self.cursor.fetchIntoTexture(0, self.tex, 0)
AttributeError: 'libpanda.MovieVideoCursor' object has no attribute 'fetchIntoTexture'

Any help would be appreciated

Looking at the API, you’re now supposed to use something like this:

buf = cursor.fetchBuffer()
cursor.applyToTexture(buf, tex, 0)

Thanks for your response, is this the API info you are referring to?
panda3d.org/reference/1.7.2/ … Cursor.php

Replaced#—>self.cursor.fetchIntoTexture(0, self.tex, 0)
With–> buf = self.cursor.fetchBuffer()
self.cursor.applyToTexture(buf, self.tex, 0)

Adjusted Code

from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from panda3d.vision import *
class Application(ShowBase):
	def __init__(self):
		ShowBase.__init__(self)
		for i in range(WebcamVideo.getNumOptions()):
			print WebcamVideo.getOption(i)
		if WebcamVideo.getNumOptions() > 0:
			opt = WebcamVideo.getOption(0)
			self.cursor = opt.open()
			self.tex = Texture()
			self.cursor.setupTexture(self.tex)
			cm = CardMaker("plane")
			cm.setFrame(-1, 1, -1, 1)
			plane = render2d.attachNewNode(cm.generate())
			plane.setTexture(self.tex)
			scaleX = float(self.cursor.sizeX()) / float(self.tex.getXSize())
			scaleY = float(self.cursor.sizeY()) / float(self.tex.getYSize())
			plane.setTexScale(TextureStage.getDefault(),
			Vec2(scaleX, scaleY))
			taskMgr.add(self.update, "update video")
	def update(self, task):
		if self.cursor.ready():
			buf = self.cursor.fetchBuffer()
         self.cursor.applyToTexture(buf, self.tex, 0)
		return task.cont
                 
w = Application()
run()

New Output

...
Assertion failed t->get_x_size() >= size_x() at line 137 of c:\buildslave\release_sdk_win32\build\panda3d\panda\src\movies\movieVideoCursor.cxx
...
AssertionError t->get_x_size() >= size_x() at line 137 of c:\buildslave\release_sdk_win32\build\panda3d\panda\src\movies\movieVideoCursor.cxx

i got the same error in my augmented reality project

win10,panda 1.9.1

I came across this thread as I encountered the same error. That assertion failure tells you panda expects texture size to be larger than or equal to movie size, so just resize the texture:

plane = render2d.attachNewNode(cm.generate())
plane.setTexture(self.tex)

if self.tex.getXSize()<self.cursor.sizeX():
        self.tex.setXSize(self.tex.getXSize()*2)
if self.tex.getYSize()<self.cursor.sizeY():
        self.tex.setYSize(self.tex.getYSize()*2)

scaleX = float(self.cursor.sizeX()) / float(self.tex.getXSize())
scaleY = float(self.cursor.sizeY()) / float(self.tex.getYSize())