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

Create file from string #1

Open
robertbilling opened this issue Jan 14, 2020 · 0 comments
Open

Create file from string #1

robertbilling opened this issue Jan 14, 2020 · 0 comments

Comments

@robertbilling
Copy link

I'm trying to write files containing a UUID to memory cards inside cameras and phones so that I can identify a card that has been seen before when a device is plugged in.

This works:

`#!/usr/bin/python3

#Tag, untag and retag memory cards

import os
import sys
import gphoto2 as gp
from ctypes import *

def main():
cam = gp . Camera ()
cam . init ()
val, tfile = gp . gp_file_open ( "orig.uui" )
p = cam . folder_put_file ( "/store_00010001/DCIM", "elephant.uui",
gp . GP_FILE_TYPE_NORMAL, tfile)
main()

`
It copies a UUID from a text file created by uuidgen to the card in the camera.

However I have completely failed to write a UUID from a Python text string without going via a disk file. I have tried creating a file and using set_data_and_size() but have not found any combination of parameters that will work.

Is there somewhere an example program for set_data_and_size() ?

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