{"id":14383700,"url":"https://github.com/jim-easterbrook/python-gphoto2","last_synced_at":"2025-09-24T13:56:58.845Z","repository":{"id":15366966,"uuid":"18098041","full_name":"jim-easterbrook/python-gphoto2","owner":"jim-easterbrook","description":"Python interface to libgphoto2","archived":false,"fork":false,"pushed_at":"2025-07-22T07:12:11.000Z","size":1607,"stargazers_count":390,"open_issues_count":8,"forks_count":59,"subscribers_count":28,"default_branch":"main","last_synced_at":"2025-08-23T19:35:12.020Z","etag":null,"topics":["gphoto2","libgphoto2","python","swig"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jim-easterbrook.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-03-25T11:34:42.000Z","updated_at":"2025-08-14T21:04:33.000Z","dependencies_parsed_at":"2025-06-02T19:08:12.160Z","dependency_job_id":"74f76e4b-ef07-41e8-b0c5-b6f39d68b96d","html_url":"https://github.com/jim-easterbrook/python-gphoto2","commit_stats":{"total_commits":637,"total_committers":8,"mean_commits":79.625,"dds":0.1161695447409733,"last_synced_commit":"63cf35b663eeb6a39884c705d1d7552e01dfd4a5"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/jim-easterbrook/python-gphoto2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim-easterbrook%2Fpython-gphoto2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim-easterbrook%2Fpython-gphoto2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim-easterbrook%2Fpython-gphoto2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim-easterbrook%2Fpython-gphoto2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jim-easterbrook","download_url":"https://codeload.github.com/jim-easterbrook/python-gphoto2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim-easterbrook%2Fpython-gphoto2/sbom","scorecard":{"id":520323,"data":{"date":"2025-08-11","repo":{"name":"github.com/jim-easterbrook/python-gphoto2","commit":"3a099f669ae63c7be0e3404c81a3ba81a17ee6c7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"15 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-wheels.yml:1","Warn: no topLevel permission defined: .github/workflows/lint_python.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-wheels.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/jim-easterbrook/python-gphoto2/build-wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-wheels.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/jim-easterbrook/python-gphoto2/build-wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-wheels.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/jim-easterbrook/python-gphoto2/build-wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint_python.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/jim-easterbrook/python-gphoto2/lint_python.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint_python.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/jim-easterbrook/python-gphoto2/lint_python.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:11","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:18","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:24","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T02:53:08.809Z","repository_id":15366966,"created_at":"2025-08-20T02:53:08.809Z","updated_at":"2025-08-20T02:53:08.809Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276761910,"owners_count":25700224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gphoto2","libgphoto2","python","swig"],"created_at":"2024-08-28T18:00:58.105Z","updated_at":"2025-09-24T13:56:58.811Z","avatar_url":"https://github.com/jim-easterbrook.png","language":"C","readme":"python-gphoto2 v\\ 2.6.2\n=======================\n\npython-gphoto2 is a comprehensive Python interface (or binding) to libgphoto2_.\nIt is built using SWIG_ to automatically generate the interface code.\nThis gives direct access to nearly all the libgphoto2 functions_, but sometimes in a rather un-Pythonic manner.\n\nOther Python bindings to libgphoto2_ are available:\npiggyphoto_ uses ctypes_ (included in standard Python installations) to interface to the library.\nThe gphoto2 source tree includes some `Python bindings`_ which also use ctypes_.\n`gphoto2-cffi`_ uses cffi_.\n\n.. contents::\n   :backlinks: top\n\nInstallation\n------------\n\nSince python-gphoto2 version 2.3.1 \"binary wheels\" are provided for many Linux and MacOS computers.\nThese include a recent version of the libgphoto2_ libraries, and pre-built Python interface modules, which makes installation quick and easy.\nUse pip_'s ``--only-binary`` option to install one of these wheels::\n\n    $ pip3 install gphoto2 --user --only-binary :all:\n\nIf this fails it is most likely because none of the available wheels is compatible with your computer.\nIn this case you *must* install some dependencies before installing python-gphoto2.\nSee `\u003cINSTALL.rst\u003e`_ for more details.\n\nRaspberry Pi\n^^^^^^^^^^^^\n\nBinary wheels for the Raspberry Pi are available from piwheels_.\nYou need to install some system packages to use these::\n\n    $ sudo apt install libexif12 libgphoto2-6 libgphoto2-port12 libltdl7\n    $ pip3 install gphoto2 --user --only-binary :all:\n\nUsing python-gphoto2\n--------------------\n\nThe Python interface to libgphoto2_ should allow you to do anything you could do in a C program.\nHowever, there are still bits missing and functions that cannot be called from Python.\nLet me know if you run into any problems.\n\nThe following paragraphs show how the Python interfaces differ from C.\nSee the example programs for typical usage of the Python gphoto2 API.\n\n\"C\" interface\n^^^^^^^^^^^^^\n\nThese functions are as similar as possible to their libgphoto2_ equivalents.\nMost of them return an error code which you must check.\n\nUsing SWIG_ to generate the Python interfaces automatically means that every function in libgphoto2_ *should* be available to Python.\nYou can show the documentation of a function with the ``pydoc`` command (or ``python -m pydoc`` if you installed gphoto2 with pip inside a virtual environment)::\n\n   $ pydoc3 gphoto2.gp_camera_folder_list_files\n   Help on built-in function gp_camera_folder_list_files in gphoto2:\n\n   gphoto2.gp_camera_folder_list_files = gp_camera_folder_list_files(...)\n       gp_camera_folder_list_files(camera, folder, context) -\u003e int\n\n       Parameters\n       ----------\n       camera: gphoto2.Camera\n       folder: str\n       context: gphoto2.Context (default=None)\n\n\n       Lists the files in supplied `folder`.\n\n       Parameters\n       ----------\n       * `camera` :\n           a Camera\n       * `folder` :\n           a folder\n       * `list` :\n           a CameraList\n       * `context` :\n           a GPContext\n\n       Returns\n       -------\n       a gphoto2 error code\n\n       See also gphoto2.Camera.folder_list_files\n\nThe first part of this text is the function signature and parameter list generated by SWIG.\n(Note that ``context`` is optional - it's only needed if you need the callback functions that can be  associated with a context.)\nThe rest of the text is copied from the \"doxygen\" format documentation in the C source code.\n(The online `API documentation`_ shows how it is intended to look.)\nNote that this includes a ``list`` parameter that is not in the function signature.\nIn C this is an \"output\" parameter, a concept that doesn't really exist in Python.\nThe Python version of ``gp_camera_folder_list_files`` returns a sequence containing the integer error code and the ``list`` value.\n\nMost of the libgphoto2_ functions that use pointer parameters to return values in the C API have been adapted like this in the Python API.\n(Unfortunately I've not found a way to persuade SWIG_ to include this extra return value in the documentation.\nYou should use ``pydoc`` to check the actual parameters expected by the Python function.)\n\nFor example, the C code:\n\n.. code:: c\n\n    #include \"gphoto2.h\"\n    int error;\n    Camera *camera;\n    error = gp_camera_new(\u0026camera);\n    ...\n    error = gp_camera_unref(camera);\n\nhas this Python equivalent:\n\n.. code:: python\n\n    import gphoto2 as gp\n    error, camera = gp.gp_camera_new()\n    ...\n\nNote that the gp_camera_unref() call is not needed.\nIt is called automatically when the Python camera object is deleted.\n\nHere is a complete example program (without any error checking):\n\n.. code:: python\n\n    import gphoto2 as gp\n    error, camera = gp.gp_camera_new()\n    error = gp.gp_camera_init(camera)\n    error, text = gp.gp_camera_get_summary(camera)\n    print('Summary')\n    print('=======')\n    print(text.text)\n    error = gp.gp_camera_exit(camera)\n\n\"Object oriented\" interface\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis is the preferred way to use libgphoto2_ from Python.\nMost of the libgphoto2_ functions have been added as methods of the appropriate GPhoto2 object.\nThis allows GPhoto2 to be used in a more \"Pythonic\" style.\nFor example, ``gp.gp_camera_init(camera)`` can be replaced by ``camera.init()``.\nThese methods also include error checking.\nIf an error occurs they raise a Python ``GPhoto2Error`` exception.\n\nThe example program can be re-written as follows:\n\n.. code:: python\n\n    import gphoto2 as gp\n    camera = gp.Camera()\n    camera.init()\n    text = camera.get_summary()\n    print('Summary')\n    print('=======')\n    print(str(text))\n    camera.exit()\n\nNo additional error checking is required.\n\nError checking\n^^^^^^^^^^^^^^\n\nMost of the libgphoto2_ functions return an integer to indicate success or failure.\nThe Python interface includes a ``check_result()`` function to check these values and raise a ``GPhoto2Error`` exception if an error occurs.\n\nThis function also removes the error code from lists such as that returned by ``gp_camera_new()`` in the example.\nUsing this function the earlier example becomes:\n\n.. code:: python\n\n    import gphoto2 as gp\n    camera = gp.check_result(gp.gp_camera_new())\n    gp.check_result(gp.gp_camera_init(camera))\n    text = gp.check_result(gp.gp_camera_get_summary(camera))\n    print('Summary')\n    print('=======')\n    print(text.text)\n    gp.check_result(gp.gp_camera_exit(camera))\n\nThere may be some circumstances where you don't want an exception to be raised when some errors occur.\nYou can \"fine tune\" the behaviour of the ``check_result()`` function by adjusting the ``error_severity`` variable:\n\n.. code:: python\n\n    import gphoto2 as gp\n    gp.error_severity[gp.GP_ERROR] = logging.WARNING\n    ...\n\nIn this case a warning message will be logged (using Python's standard logging module) but no exception will be raised when a ``GP_ERROR`` error occurs.\nHowever, this is a \"blanket\" approach that treats all ``GP_ERROR`` errors the same.\nIt is better to test for particular error conditions after particular operations, as described below.\n\nThe ``GPhoto2Error`` exception object has two attributes that may be useful in an exception handler.\n``GPhoto2Error.code`` stores the integer error generated by the library function and ``GPhoto2Error.string`` stores the corresponding error message.\n\nFor example, to wait for a user to connect a camera you could do something like this:\n\n.. code:: python\n\n    import gphoto2 as gp\n    ...\n    print('Please connect and switch on your camera')\n    while True:\n        try:\n            camera.init()\n        except gp.GPhoto2Error as ex:\n            if ex.code == gp.GP_ERROR_MODEL_NOT_FOUND:\n                # no camera, try again in 2 seconds\n                time.sleep(2)\n                continue\n            # some other error we can't handle here\n            raise\n        # operation completed successfully so exit loop\n        break\n    # continue with rest of program\n    ...\n\nWhen just calling a single function like this, it's probably easier to test the error value directly instead of using Python exceptions:\n\n.. code:: python\n\n    import gphoto2 as gp\n    ...\n    print('Please connect and switch on your camera')\n    while True:\n        error = gp.gp_camera_init(camera)\n        if error \u003e= gp.GP_OK:\n            # operation completed successfully so exit loop\n            break\n        if error != gp.GP_ERROR_MODEL_NOT_FOUND:\n            # some other error we can't handle here\n            raise gp.GPhoto2Error(error)\n        # no camera, try again in 2 seconds\n        time.sleep(2)\n    # continue with rest of program\n    ...\n\nLogging\n^^^^^^^\n\nThe libgphoto2_ library includes functions (such as ``gp_log()``) to output messages from its various functions.\nThese messages are mostly used for debugging purposes, and it can be helpful to see them when using libgphoto2_ from Python.\nThe Python interface includes a ``use_python_logging()`` function to connect libgphoto2_ logging to the standard Python logging system.\nIf you want to see the messages you should call ``use_python_logging()`` near the start of your program, as shown in the examples.\nIn normal use you probably don't want to see these messages (libgphoto2_ is rather verbose) so this could be controlled by a \"verbose\" or \"debug\" option in your application.\n\nThe libgphoto2_ logging messages have four possible severity levels, each of which is mapped to a suitable Python logging severity.\nYou can override this mapping by passing your own to ``use_python_logging()``:\n\n.. code:: python\n\n    import logging\n    import gphoto2 as gp\n    ...\n    callback_obj = gp.check_result(gp.use_python_logging(mapping={\n        gp.GP_LOG_ERROR   : logging.INFO,\n        gp.GP_LOG_DEBUG   : logging.DEBUG,\n        gp.GP_LOG_VERBOSE : logging.DEBUG - 3,\n        gp.GP_LOG_DATA    : logging.DEBUG - 6}))\n    ...\n\nIf you prefer to use your own logging system you can define a logging callback function in Python.\nThe function must take 3 or 4 parameters: ``level``, ``domain``, ``string`` and an optional ``data``.\nThe ``data`` parameter allows you to pass some user data to your callback function (e.g. to log which thread an error occurred in):\nThe callback function is installed with ``gp_log_add_func``:\n\n.. code:: python\n\n    import gphoto2 as gp\n    ...\n    def callback(level, domain, string, data=None):\n        print('Callback: level =', level, ', domain =', domain, ', string =', string, 'data =', data)\n    ...\n    callback_obj1 = gp.check_result(gp.gp_log_add_func(gp.GP_LOG_VERBOSE, callback))\n    callback_obj2 = gp.check_result(gp.gp_log_add_func(gp.GP_LOG_VERBOSE, callback, 123))\n    ...\n\nDeprecated functions\n--------------------\n\nSome functions are intended for use by camera drivers and should not have been included in the Python interface.\nThey will be removed in a future release.\nDuring testing you should run your software with Python's ``-Wd`` flag to show the warnings issued if you use any of the deprecated functions.\nPlease contact me if you have reason to believe a deprecated function should not be removed.\n\nWhat to do if you have a problem\n--------------------------------\n\nIf you find a problem in the Python gphoto2 interface (e.g. a segfault, a missing function, or a function without a usable return value) then please report it on the GitHub \"issues\" page (https://github.com/jim-easterbrook/python-gphoto2/issues) or email jim@jim-easterbrook.me.uk.\n\nIf your problem is more general, e.g. difficulty with capturing multiple images, then try doing what you want to do with the `gphoto2 command line program`_.\nIf the problem persists then it might be worth asking on the `gphoto-user mailing list`_.\nAnother reader of the mailing list may have the same camera model and already know what to do.\n\nNotes on some gphoto2 functions\n-------------------------------\n\ngp_camera_capture_preview / gp_camera_file_get\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nBefore python-gphoto2 version 2.5.0 these functions (and their corresponding \"object oriented\" methods) always allocated and returned a new ``CameraFile`` object.\nNow you can pass in a previously allocated ``CameraFile`` for them to use, but this is deprecated.\nIn this case it is not returned by the function.\n\nIf you need to use a ``Context`` value with these functions without passing in a ``CameraFile``, then pass ``None`` in place of the ``CameraFile`` object.\nIn a future release the ``CameraFile`` parameter will be removed.\n\ngp_log_add_func / use_python_logging\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSince python-gphoto2 version 2.0.0 these functions return a sequence containing an error code and an object storing details of the callback.\nThe callback is automatically uninstalled when this object is deleted.\n\nIn earlier versions of python-gphoto2 these functions return an integer id that must be passed to ``gp_log_remove_func`` to uninstall the callback.\n\ngp_context_set_idle_func / gp_context_set_progress_funcs / etc.\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThese functions are only usable since python-gphoto2 version 1.9.0.\nThey return a Python object which your program must store until the callback(s) are no longer required.\nDeleting the returned object cancels the callback(s), so there is no need to do this yourself.\nSee the ``context_with_callbacks.py`` example for a convenient way to do this.\n\ngp_file_get_data_and_size / CameraFile.get_data_and_size\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSince python-gphoto2 version 2.4.0 these functions return a Python memoryview_ object.\nPrior to that they returned a ``FileData`` object that supports the `buffer protocol`_ so its data can be made accessible to Python by using a memoryview_ object.\nThis allows the data to be used without copying.\nSee the ``copy-data.py`` example for typical usage.\n\nNote that if the CameraFile object is deleted, or another function (such as ``gp_file_set_data_and_size`` or ``gp_file_open``) changes the CameraFile's data, then this object will be invalidated and you will probably get a segmentation fault.\n\ngp_file_set_data_and_size / CameraFile.set_data_and_size\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSince python-gphoto2 version 2.1.0 these functions accept any `bytes-like object`_.\nIn earlier versions of python-gphoto2 these functions required a string and its length, and didn't work correctly anyway.\n\ngp_camera_file_read / Camera.file_read\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe ``buf`` parameter can be any Python object that exposes a writeable buffer interface.\nThis allows you to read a file directly into a Python object without additional copying.\nSee the ``copy-chunks.py`` example which uses memoryview_ to expose a bytearray_.\n\ngp_camera_wait_for_event / Camera.wait_for_event\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThese functions return both the event type and the event data.\nThe data you get depends on the type.\n``GP_EVENT_FILE_ADDED`` and ``GP_EVENT_FOLDER_ADDED`` events return a ``CameraFilePath``, others return ``None`` or a text string.\n\nLicence\n-------\n\n| python-gphoto2 - Python interface to libgphoto2\n| http://github.com/jim-easterbrook/python-gphoto2\n| Copyright (C) 2014-23  Jim Easterbrook  jim@jim-easterbrook.me.uk\n\npython-gphoto2 is free software: you can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\npython-gphoto2 is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with python-gphoto2.  If not, see\n\u003chttps://www.gnu.org/licenses/\u003e.\n\n.. _API documentation: http://www.gphoto.org/doc/api/\n.. _buffer protocol:   https://docs.python.org/3/c-api/buffer.html\n.. _bytearray:         https://docs.python.org/3/library/functions.html#bytearray\n.. _bytes-like object: https://docs.python.org/3/glossary.html#term-bytes-like-object\n.. _cffi:              http://cffi.readthedocs.org/\n.. _ctypes:            https://docs.python.org/3/library/ctypes.html\n.. _functions:         http://www.gphoto.org/doc/api/\n.. _GitHub:            https://github.com/jim-easterbrook/python-gphoto2\n.. _gphoto2-cffi:      https://github.com/jbaiter/gphoto2-cffi\n.. _gphoto2 command line program:\n                       http://gphoto.org/doc/manual/using-gphoto2.html\n.. _gphoto-user mailing list:\n                       http://gphoto.org/mailinglists/\n.. _libgphoto2:        http://www.gphoto.org/proj/libgphoto2/\n.. _memoryview:        https://docs.python.org/3/library/stdtypes.html#memoryview\n.. _Python bindings:\n   http://sourceforge.net/p/gphoto/code/HEAD/tree/trunk/bindings/libgphoto2-python/\n.. _piggyphoto:        https://github.com/alexdu/piggyphoto\n.. _pip:               https://pip.pypa.io/\n.. _piwheels:          https://www.piwheels.org/project/gphoto2/\n.. _SWIG:              http://swig.org/\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim-easterbrook%2Fpython-gphoto2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjim-easterbrook%2Fpython-gphoto2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim-easterbrook%2Fpython-gphoto2/lists"}