ctao707
ctao707
2015-10-21 09:49

python VideoCapture使用时,报错

  • python

python 3.4.3
VideoCapture VideoCapture-0.9.5-cp34
Pillow 3.0

代码:
import os
from VideoCapture import Device
import time

SLEEP_TIME = 3
i = 0
cam = Device(devnum=0, showVideoWindow=0)
while i < 10:
cam_time = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
cam_name = 'camera' + cam_time + '.jpg'
cam.saveSnapshot(cam_name, 3, 1, 'bl')
os.remove(cam_name)
time.sleep(SLEEP_TIME)
i += 1

运行时,提示
File "D:\Python34\lib\site-packages\VideoCapture__init__.py", line 234, in saveSnapshot
self.getImage(timestamp, boldfont, textpos).save(filename, **keywords)
File "D:\Python34\lib\site-packages\VideoCapture__init__.py", line 154, in getImage
'RGB', (width, height), buffer, 'raw', 'BGR', 0, -1)
File "D:\Python34\lib\site-packages\PIL\Image.py", line 2053, in fromstring
"Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.

请问有什么解决办法

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答