Closed inobotica closed 7 years ago
I think gp_camera_folder_put_file()
is the function you want. gp_file_open()
should read your local file into a CameraFile
object you can pass to gp_camera_folder_put_file()
.
Hi,
I have been working with the functions that you recommended me, but i am having problem with the creation of CameraFile object, it seems that i am not creating a correct CameraFile object and the gp_file_open() is not reading it throwing an error "Argument 1 of type CameraFile ". How i create a CameraFile object correctly?
here is my code:
def file_mover(): camera_file = gp.gp_file_new() # Create a CameraFile object gp.gp_file_open(camera_file,name) # Pass the image (in RPi) to the CameraFile object gp.check_result(gp.gp_camera_put_file(camera,folder,camera_file,context)) # Save the image in NIKON S3700 SDcard
Thanks for the help,
Hi, I am trying to download files from the camera not upload. Thanks, Chris
hi Chris,
use the capture-image.py example, you just have to change the target address of the file, in the line 45
gp.check_result(gp.gp_file_save(camera_file,'gphoto.jpg')) #this will save the gphoto.jpg in root of the pi
Chris, please don't change the subject of an "issue". If you have found a different bug in python-gphoto2 you should create a new issue for it.
Daniel, the gp_file_new()
function returns an integer error code and the CameraFile object. Use check_result()
to strip the error code and return just the CameraFile object. (In the next release of python-gphoto2 I'll make gp_file_open()
allocate and return a new CameraFile object. This would be more consistent with the other functions.)
Jim thank you so much (for the help and the development of this library), now i am able to take pictures, modify them in RPi then save it back to the camera. This library is very usefull and easy to use.
I've just released version 1.5.0 which has the changed gp_file_open()
as mentioned above.
Good, im going to upgrade it, i have been problems writing back the images to the camera sometimes appears a (-7) I/O problem, sometimes writes without problem, according to what i have researched it seems to see permission issues, may be you wonder why?
Things that sometimes work and sometimes don't are hard to diagnose. The Raspberry Pi USB system has had problems in the past. If you can try a different sort of computer you might find it works OK. I don't think many people write images back to the camera, so this part of libgphoto2 might not be well tested.
i have captured and downloaded images from the camera successfully thanks to your python library for Pi, now i want to copy the photos from the raspberry to the camera again, the application that i am working is geotagging images, so i take the picture, download to /pi/ add exif data and i want to move back to the camera, i have checked the functions but i dont see a specific function that do it.