No module named _camera

Issue #76 wontfix
Former user created an issue

Hi, When ever a call to the module is made, it raises this error message : (this is under windows 7)

"" Traceback (most recent call last): File "", line 1, in <module> File "C:\Python27\lib\site-packages\pygame\", line 42, in init import _camera ImportError: No module named _camera ""

Has any solution been found for this problem ??

Comments (11)

  1. Former user Account Deleted

    Thank you, the above problem is solved. I had an other problem i.e. with respect to the capturing of a image from a webcam and saving it. I wrote a small code to do this, but on executing the program i am just getting a black(blank) image of size(640,480).

    "import pygame

    from pygame import camera


    window = pygame.display.set_mode((640,480),0)

    cam =


    image = cam.get_image(),'abc.jpg')


    It also opens the pygame window but that is also blank, and it goes to the NOT RESPONDING state in a seconds time. Any solutions you could suggest me regarding the above?

  2. Former user Account Deleted

    I don't understand what that means: "Changed component from nothing to camera." Do you mean the packages imported. I also tried


    import pygame


    from pygame.locals import *


    it still does not work ? Any suggestions ?

  3. René Dudfield
    • changed status to open


    it looks like the camera package is not working on your system. The package is not complete, so it does not work on all platforms yet. Which OS are you on?

  4. Former user Account Deleted

    Oh ok now i get it .. I am using Windows 7.

    I just got it to work .. Here's a simple code :


    import pygame


    from pygame.locals import *

    import time


    size = (640,480)

    d = pygame.display.set_mode(size,0)

    s = pygame.surface.Surface(size,0,d)

    cam =,size)


    s = cam.get_image(s)



    This opens the pygame window which still is "NOT RESPONDING" but the image is stored in the memory ... Hope this helps someone else trying out pygame.

    Now i was trying to change the frame rate, exposure time, etc . . Is it possible to control those by the pygame package ?? Any suggestion ??

  5. René Dudfield


    you'll need to have an event loop in there. Otherwise the window can not process events.

    See the examples for how it is done.


  6. Former user Account Deleted


    I had a look at the events loop but it is not very clear why that is required(is it just used to stop the camera on a certain event) ? could you kindly give me a small explanation. could i not directly use the command without the event check??

    what does it mean "if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE)" does that mean i have to press the down arrow key and then press escape ?? how do i enable the QUIT part ?

    I had an other problem with the query_image, once i put the command in then i get an error as :


    Traceback (most recent call last):

    File "C:/.... .py", line 49, in <module>


    AttributeError: Camera instance has no attribute 'query_image'


    I looked at the pygame files and it has no query_image instance, but all the sources say there is a query_image instance. Am i making a mistake or Is there any alternate i could use?? I have to try the query_image instance as the material says "if you don't want to tie the framerate to the camera, you can check if the camera has an image ready." This would help in the setting of the frame rate to a certain value such that a image is present before the next image is captured. Am i understanding that right ?

    Is there any way to control the exposure rate as well ?

    What do you suggest ?


  7. Former user Account Deleted

    I am having the same problem as the original poster stated: "ImportError: No module names _Camera".

    I am running a program which works on Ubuntu 10.04 with Python 2.6.5 and PyGame 1.9.1

    It does not work on Windows XP SP3 with ActiveState Python and PyGame 1.9.1 It does not work on Windows XP SP3 with Python 2.7 and PyGame 1.9.2a0

    In each case it does this:

    >>> ================================ RESTART ================================
    >>> import
    Traceback (most recent call last):
      File "<pyshell#3>", line 1, in <module>
      File "C:\Python27\lib\site-packages\pygame\", line 42, in init
        import _camera
    ImportError: No module named _camera

    (Strangely, the library file looks the same on both the working Ubuntu machine and the non-working XP machine in that it says "import _camera" on line 42 of both.)

    Any ideas?

  8. Log in to comment