2

I have a fresh install of Ubuntu 12.04, ran all the updates, then ran sudo apt-get install build-essential python-dev libsdl1.2-dev python-pygame. However, when I run the following in the python interpreter:

import pygame
import pygame.camera
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.get_image()

I get:

Fatal Python error: (pygame parachute) Segmentation Fault
Aborted (core dumped)

Any suggestions?

Update: this occurs with a fresh install of 11.10 as well.

Mike Lawrence
  • 1,641
  • 5
  • 20
  • 40
  • This post http://stackoverflow.com/questions/2663841/python-tracing-a-segmentation-fault might help you at least pin down which line is causing the problem. – mgilson May 31 '12 at 13:28
  • Oh, the segfault definitely occurs at the final line (I entered the lines one by one). – Mike Lawrence May 31 '12 at 13:33

1 Answers1

4

Well, the solution was head-smackingly simple: I forgot to call cam.start() before cam.get_image().

Mike Lawrence
  • 1,641
  • 5
  • 20
  • 40