<div dir="ltr"><b>Hey,</b><div><b><br></b></div><div><b>I am working on camera plugin for sugar cordova.</b></div><div><b><br></b></div><div><b>I used pygame to click the user's photograph by the following code : </b></div>

<div><br></div><div><div><font color="#990000"><br></font></div><div><font color="#990000">    def camera(self,request):</font></div><div><font color="#990000">        os.environ['SDL_VIDEO_CENTERED'] = '1'</font></div>

<div><font color="#990000">        pygame.init()</font></div><div><font color="#990000"><span style="white-space:pre-wrap"> </span>pygame.camera.init()</font></div><div><font color="#990000">        screen=pygame.display.set_mode((640,480),pygame.NOFRAME )</font></div>

<div><font color="#990000">    <span style="white-space:pre-wrap">      </span>camlist = pygame.camera.list_cameras()</font></div><div><font color="#990000">    <span style="white-space:pre-wrap">  </span>if camlist:</font></div>

<div><font color="#990000">            cam = pygame.camera.Camera(camlist[0],(640,480))</font></div><div><font color="#990000"><span style="white-space:pre-wrap">        </span>cam.start()</font></div><div><font color="#990000">        quit_loop=0</font></div>

<div><font color="#990000">        base64data=None</font></div><div><font color="#990000">        while quit_loop == 0:</font></div><div><font color="#990000"><span style="white-space:pre-wrap">    </span>    cam_image=cam.get_image()</font></div>

<div><font color="#990000"><span style="white-space:pre-wrap">    </span>    screen.blit(cam_image,(0,0))</font></div><div><font color="#990000"><span style="white-space:pre-wrap">    </span>    pygame.display.update()</font></div>

<div><font color="#990000"><span style="white-space:pre-wrap">    </span>    for event in pygame.event.get():</font></div><div><font color="#990000"><span style="white-space:pre-wrap">                </span>if event.type == MOUSEBUTTONDOWN:</font></div>

<div><font color="#990000">                    data = pygame.image.tostring(screen,"RGBA")</font></div><div><font color="#990000">                    base64data = base64.b64encode(data)</font></div><div><font color="#990000">                    #logging.error("base64 :\n %s",base64data)</font></div>

<div><font color="#990000"><span style="white-space:pre-wrap">            </span>    </font><span style="color:rgb(153,0,0)">cam.stop()</span></div><div><font color="#990000">                    pygame.display.quit()</font></div>
<div><font color="#990000">                    quit_loop=1</font></div><div><font color="#990000">        logging.error("got base64 image")</font></div><div><font color="#990000">        self._client.send_result(request,base64data)</font></div>

<div><font color="#990000">        </font></div></div><div><br></div><div><br></div><div><b><br></b></div><div><b>The issue is that I am not able to send data back to the javascript side from python side.</b></div>
<div><b><br></b></div><div><b>I am attaching shell.log along if anyone wishes to have a look over it.</b></div><div><br></div><div><b>would be nice if someone can help me know why am I not able to send the data to javascript side.</b></div>
<div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div>Regards,</div><div>Puneet</div><div><b><br></b></div><div><b> </b></div>
</div>