Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception right after InsertPhotoSimple #8

Open
DaveSprague opened this issue May 8, 2014 · 0 comments
Open

Exception right after InsertPhotoSimple #8

DaveSprague opened this issue May 8, 2014 · 0 comments

Comments

@DaveSprague
Copy link

I'm getting exceptions that happen right after the InsertPhotoSimple, around lines 75 - 77 in the current version of the script. Here's the debug level log file -- note that I have added a couple of extra logging.debug statements after each of the original source statements to try to narrow down what's causing the exception:

2014-05-08 01:30:57 DEBUG: Starting up....
2014-05-08 01:30:57 DEBUG: OrderedDict([('__name__', 'CONFIG'), ('scratchimagewidth', '100'), ('scratchimageheight', '75'), ('upload_scratch_pics', 'yes'), ('hrs_to_loop', '3'), ('picture_threshold', '15'), ('picture_sensitivity', '50'), ('forcecapture', 'True'), ('forcecapturetime', '3600')])
2014-05-08 01:30:57 DEBUG: OrderedDict([('__name__', 'PICTURE'), ('album_name', 'RasPiMotionDetect'), ('album_name_suffix', '_%d-%m-%y'), ('file_name_prefix', 'Motion Detected'), ('camera_rotation', '0'), ('cam_options', '-rot 180 -t 10 -q 65')])
2014-05-08 01:30:57 DEBUG: OrderedDict([('__name__', 'selectivescan'), ('areax1', '1, 100'), ('areay1', '1, 75'), ('scratchdebugmode', 'False')])
2014-05-08 01:30:57 DEBUG: Login to Picasa
2014-05-08 01:30:58 DEBUG: get_album_url for: RasPiMotionDetect_08-05-14
2014-05-08 01:30:58 DEBUG: Searching for album RasPiMotionDetect_08-05-14_0
2014-05-08 01:30:58 DEBUG: Album Search. Suffix is 0
2014-05-08 01:30:58 DEBUG: Selecting album RasPiMotionDetect_08-05-14_0! It has 20 pictures in it
2014-05-08 01:30:58 DEBUG: Setup Threads & Queues
2014-05-08 01:30:58 DEBUG: get_album_url for: RasPiMotionDetect_08-05-14_thumbs
2014-05-08 01:30:58 DEBUG: FullUploader Wait on queue
2014-05-08 01:30:59 DEBUG: Searching for album RasPiMotionDetect_08-05-14_thumbs_0
2014-05-08 01:30:59 DEBUG: Album Search. Suffix is 0
2014-05-08 01:30:59 DEBUG: Selecting album RasPiMotionDetect_08-05-14_thumbs_0! It has 5 pictures in it
2014-05-08 01:30:59 DEBUG: ThumbUploader Wait on queue
2014-05-08 01:31:00 DEBUG: Main Loop start
2014-05-08 01:31:00 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:01 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:03 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:04 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:06 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:07 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:08 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:10 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:11 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:13 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:14 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:15 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:17 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:18 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:20 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:21 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:22 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:24 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:25 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:27 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:28 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:29 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:31 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:32 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:34 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:35 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:36 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:38 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:39 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:40 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:42 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:44 DEBUG: hirez queue push
2014-05-08 01:31:44 DEBUG: FullUploader: popped one off the queue
2014-05-08 01:31:44 DEBUG: low rez queue push
2014-05-08 01:31:44 DEBUG: ThumbUploader: popped one off the queue
2014-05-08 01:31:44 DEBUG: Current queue size FullSize:0 ThumbSize:0
2014-05-08 01:31:46 DEBUG: ThumbUploader: Pic uploaded to Picasa. Photos in album: 6
2014-05-08 01:31:46 DEBUG: close completed
2014-05-08 01:31:46 CRITICAL: InsertPhotoSimple barfed! Exception: 'cStringIO.StringO' object has no attribute 'name'
2014-05-08 01:31:47 DEBUG: hirez queue push
2014-05-08 01:31:47 DEBUG: low rez queue push
2014-05-08 01:31:47 DEBUG: Current queue size FullSize:1 ThumbSize:1
2014-05-08 01:31:47 CRITICAL: InsertPhotoSimple barfed! Exception: I/O operation on closed file
2014-05-08 01:31:48 CRITICAL: InsertPhotoSimple barfed! Exception: I/O operation on closed file
2014-05-08 01:31:48 CRITICAL: InsertPhotoSimple barfed! Exception: I/O operation on closed file
2014-05-08 01:31:49 CRITICAL: InsertPhotoSimple barfed! Exception: I/O operation on closed file
2014-05-08 01:31:49 CRITICAL: InsertPhotoSimple barfed! Exception: I/O operation on closed file
2014-05-08 01:31:49 DEBUG: hirez queue push
2014-05-08 01:31:49 DEBUG: low rez queue push
2014-05-08 01:31:49 DEBUG: Current queue size FullSize:2 ThumbSize:2
2014-05-08 01:31:50 DEBUG: FullUploader: Pic uploaded to Picasa. Photos in album: 21
2014-05-08 01:31:50 DEBUG: close completed
2014-05-08 01:31:50 DEBUG: after filehandle close, filehandle.name = /tmp/tmpPkN1QJ.jpg
2014-05-08 01:31:50 DEBUG: unlinked if needed
2014-05-08 01:31:50 DEBUG: completed task_done
2014-05-08 01:31:50 DEBUG: FullUploader Wait on queue

Here's the section of code with the logging debug lines I added:

           while True:
                try:
                    photo = self.album_params.gdata.picasa.InsertPhotoSimple(
                                                          self.album_params.album_url,
                                                          picasa_filename,
                                                          '',
                                                          filehandle,
                                                          content_type=pic_type)
                    logging.debug("%s: Pic uploaded to Picasa. Photos in album: %d" %(self.myname, (self.album_params.num_photos+\
1)))
                    filehandle.close()
                    logging.debug("close completed")
                    logging.debug("after filehandle close, filehandle.name = %s", filehandle.name)
                    if (os.path.exists(filehandle.name)):
                        os.unlink(filehandle.name)
                    logging.debug("unlinked if needed")
                    self.q.task_done()
                    logging.debug("completed task_done")
                    self.album_params.num_photos += 1
                    if (self.album_params.num_photos >= MAX_PHOTOS_PER_ALBUM):
                        # limit for the number of photos per album in Picasa.                                                      
                        logging.info("exceeded max number of photos per album. Create new one")
                        self.create_next_album()

The exception seems to occur in some, but not all, cases where you reference filehandle.name after the filehandle is closed??

Let me know what other info would be useful. Thanks,

Dave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant