richq / folders2flickr

Upload files to flickr
Other
102 stars 38 forks source link

AttributeError: 'Photo' object has no attribute 'delete' #46

Open mmaciejow opened 9 years ago

mmaciejow commented 9 years ago

Hi, Thanks for project, good work :)

When I try upload video (mov ~ 285mb), get:

Traceback (most recent call last): File "./folders2flickr", line 8, in f2flickr.uploadr.main() File "/home/pi/.local/lib/python2.7/site-packages/f2flickr/uploadr.py", line 663, in main for uploaded in uploadinstance.upload(group): File "/home/pi/.local/lib/python2.7/site-packages/f2flickr/uploadr.py", line 373, in upload up = self.uploadImage( image ) File "/home/pi/.local/lib/python2.7/site-packages/f2flickr/uploadr.py", line 405, in uploadImage photo.delete() File "/home/pi/.local/lib/python2.7/site-packages/f2flickr/flickr.py", line 116, in getattr val = self._val(key) File "/home/pi/.local/lib/python2.7/site-packages/f2flickr/flickr.py", line 113, in _val return super(Photo, self).getattribute(key) AttributeError: 'Photo' object has no attribute 'delete'

I tried convert video (e.g mp4) and doesn't work, Other files *.mov work fine. Only this one file doesn't want upload. How fix it? Thanks for reply

richq commented 9 years ago

That snippet of code is when the file is already on flickr - first it tried to remove the old version then it would have tried to upload the new version. Does that sequence of events fit with the file you had? I'll see if I can reproduce it, I haven't tried a video file so large before but if others work I don't think it's size related.

richq commented 9 years ago

Oh man, just looked at the code. There's no way this could have worked, what a bug. thanks for the report.

mmaciejow commented 9 years ago

I removed from Flickr and still the same. I sent the files up to 700 mb (video) and work.

Before error i get:

2015-07-26 13:47:53,255 uploadr.py:650 - main() Finding new photos from folder /mnt/DYSK_USB/Obrazy/Zdjecia/ 2015-07-26 13:47:55,631 uploadr.py:652 - main() Found 5594 images 2015-07-26 13:47:55,636 uploadr.py:655 - main() Converting existing history file to new format, if needed ..... 2015-07-26 13:48:01,235 flickr2history.py:101 - convert_format() num_images=5594 num_ok=5593 num_not_found=1 num_converted=0 2015-07-26 13:48:01,241 uploadr.py:657 - main() Conversion complete 2015-07-26 13:48:16,522 uploadr.py:401 - uploadImage() File has changed since previous time 2015-07-26 13:48:16,526 uploadr.py:402 - uploadImage() Removing 19517785818 from Flickr before updating Traceback (most recent call last): [....]

XioNoX commented 8 years ago

I'm having the same issue after doing the followings: 1/ start uploading pictures 2/ notice you're uploading the wrong folder, ctrl+c the script 3/ Delete the pictures from flickr 4/ Try to re-upload the same picture under a different directory tree

bnixon67 commented 8 years ago

Any possible work around for this bug? I am having the same issue. I started uploading and cancelled via Ctrl-C and upon restart, I get AttributeError: 'Photo' object has no attribute 'delete'

2016-03-20 23:44:27,801 uploadr.py:498 - uploadImage() Uploading image /Volumes/MacHD/Users/Shared/Pictures/Albums/1976/1976-10 X01 002.JPG with tags "#/1976/1976-10 X01 002.JPG" 1976 ^CStopping uploads... Updating set 1976 with 63 pictures mini:folders2flicker bnixon$ ./folders2flickr using uploadr.ini file "/Users/bnixon/folders2flicker/uploadr.ini" 2016-03-20 23:44:36,303 uploadr.py:659 - main() Finding new photos from folder /Volumes/MacHD/Users/Shared/Pictures/Albums 2016-03-20 23:44:36,498 uploadr.py:661 - main() Found 9101 images 2016-03-20 23:44:36,498 uploadr.py:664 - main() Converting existing history file to new format, if needed ......... 2016-03-20 23:44:37,544 flickr2history.py:101 - convert_format() num_images=9101 num_ok=806 num_not_found=8295 num_converted=0 2016-03-20 23:44:37,545 uploadr.py:666 - main() Conversion complete 2016-03-20 23:44:37,552 uploadr.py:401 - uploadImage() File has changed since previous time 2016-03-20 23:44:37,552 uploadr.py:402 - uploadImage() Removing 25829791392 from Flickr before updating Traceback (most recent call last): File "./folders2flickr", line 8, in f2flickr.uploadr.main() File "/Users/bnixon/Library/Python/2.7/lib/python/site-packages/f2flickr/uploadr.py", line 672, in main for uploaded in uploadinstance.upload(group): File "/Users/bnixon/Library/Python/2.7/lib/python/site-packages/f2flickr/uploadr.py", line 373, in upload up = self.uploadImage( image ) File "/Users/bnixon/Library/Python/2.7/lib/python/site-packages/f2flickr/uploadr.py", line 405, in uploadImage photo.delete() File "/Users/bnixon/Library/Python/2.7/lib/python/site-packages/f2flickr/flickr.py", line 116, in getattr val = self._val(key) File "/Users/bnixon/Library/Python/2.7/lib/python/site-packages/f2flickr/flickr.py", line 113, in _val return super(Photo, self).getattribute(key) AttributeError: 'Photo' object has no attribute 'delete'

bnixon67 commented 8 years ago

Further update - this isn't just related to cancelling the script. If I change the time on local file and rerun the script to force an upload, I get the same no attribute 'delete' error.

bnixon67 commented 8 years ago

I was able to fix this by adding a delete method to the Photo class. There are multiple versions of flickr.py available and the version include in this project doesn't have this method.

In flickr.py:

def delete(self):
    """Delete photo from flickr
    (flickr.photos.delete)
    """
    method = 'flickr.photos.delete'

    _dopost(method, auth=True, photo_id=self.id)
richq commented 8 years ago

Thanks for investigating this. It broke with the feature to re-upload a changed photo.

richq commented 8 years ago

Hmm the plot thickens - https://github.com/richq/folders2flickr/blob/master/f2flickr/flickr.py#L539 - the delete method is in this version of flickr.py... could you have another version on your PYTHONPATH that is picked up first?

therealdealneil commented 8 years ago

@richq The line you reference is in the Photoset class instead of Photo. the delete method was removed from the Photo class in commit #43 . I created a pull request #53 which seems to fix it by reintroducing this method.