alexdu / piggyphoto Goto Github PK
View Code? Open in Web Editor NEWPython bindings for libgphoto2
Python bindings for libgphoto2
Hi Alex.
I don't know if you still follow this but if TRUE i have a question.
Is it possible to leave the the captured Image on the SD Card? And how do's this Look like?
Sorry for my english ;)
Hello, I cannot change the settings on my canon eos 600d from fedora 16, python 2.7.3, gphoto2 2.4.14
import piggyphoto as pp
C.leave_locked()
C.config.main.imgsettings.iso.value = 3
Segmentation violation (core dumped)
Hi,
I forked your project and am using it for one of mine. In your readme, you encourage usage but you don't have a license. If you could add (an open source) one, that would be really great.
If you're interested I can share my modified version (python3 compatible)
I installed Python 2.7, gphoto2 and libgphoto2 through Macports on Mac OS X, and updated the library link within __init__.py
to point to the correct file.
However running the snap.py script distributed with piggyphoto now results in a segmentation fault.
I previously installed and configured this same script, based on piggyphoto, successfully on another Mac OS machine. However, since that time two things have changed in the environment I'm working with.
I'm strongly suspecting it's the GPhoto2 version change which is the underlying issue. Any idea what changes I can make to piggyphoto for compatibility with Gphoto2, or if I can rebuild/debug the ctypes bindings somehow.
The segmentation fault report is shown below...
Process: Python [10192]
Path: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.7.3 (2.7.3)
Code Type: X86-64 (Native)
Parent Process: bash [10053]
User ID: 501
Date/Time: 2012-12-05 11:34:53.440 +0000
OS Version: Mac OS X 10.8.2 (12C60)
Report Version: 10
Interval Since Last Report: 514586 sec
Crashes Since Last Report: 18
Per-App Crashes Since Last Report: 8
Anonymous UUID: 50026D50-C834-ED68-C2D0-BF884AC86E6C
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000007845de60
VM Regions Near 0x7845de60:
-->
__TEXT 0000000109f0e000-0000000109f0f000 [ 4K] r-x/rwx SM=COW /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libgphoto2.dylib 0x000000010a31a006 gp_context_progress_start + 134
1 libgphoto2.dylib 0x000000010a3128ec gp_abilities_list_load_dir + 428
2 libgphoto2.dylib 0x000000010a312c1f gp_abilities_list_load + 63
3 libgphoto2.dylib 0x000000010a315bb2 gp_camera_init + 194
4 _ctypes.so 0x000000010a2be134 ffi_call_unix64 + 76
5 _ctypes.so 0x000000010a2be92b ffi_call + 795
6 _ctypes.so 0x000000010a2b9941 _ctypes_callproc + 865
7 _ctypes.so 0x000000010a2b35c0 PyCFuncPtr_call + 272
8 org.python.python 0x0000000109f22481 PyObject_Call + 97
9 org.python.python 0x0000000109fb2a5a PyEval_EvalFrameEx + 10618
10 org.python.python 0x0000000109fb7622 fast_function + 178
11 org.python.python 0x0000000109fb2838 PyEval_EvalFrameEx + 10072
12 org.python.python 0x0000000109fb0096 PyEval_EvalCodeEx + 1990
13 org.python.python 0x0000000109f45a6b function_call + 347
14 org.python.python 0x0000000109f22481 PyObject_Call + 97
15 org.python.python 0x0000000109f2dfa6 instancemethod_call + 502
16 org.python.python 0x0000000109f22481 PyObject_Call + 97
17 org.python.python 0x0000000109f7b00b slot_tp_init + 187
18 org.python.python 0x0000000109f72c84 type_call + 372
19 org.python.python 0x0000000109f22481 PyObject_Call + 97
20 org.python.python 0x0000000109fb2a5a PyEval_EvalFrameEx + 10618
21 org.python.python 0x0000000109fb0096 PyEval_EvalCodeEx + 1990
22 org.python.python 0x0000000109faf8c6 PyEval_EvalCode + 54
23 org.python.python 0x0000000109fd6aee PyRun_FileExFlags + 174
24 org.python.python 0x0000000109fd6659 PyRun_SimpleFileExFlags + 777
25 org.python.python 0x0000000109fea378 Py_Main + 2952
26 libdyld.dylib 0x00007fff82d4b7e1 start + 1
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0xdf2ff3b00d28f950 rbx: 0x0000000000000000 rcx: 0x0000000000000002 rdx: 0x000000010a324310
rdi: 0x000000007845de50 rsi: 0x000000010a32422b rbp: 0x00007fff55ce7790 rsp: 0x00007fff55ce7670
r8: 0x00007fff55cf1bf0 r9: 0x00000000ffffffe8 r10: 0x0000000000000000 r11: 0x00000000ffffffe8
r12: 0x0000000000000000 r13: 0x00007fa87848e1d0 r14: 0x000000010a32422b r15: 0x000000007845de50
rip: 0x000000010a31a006 rfl: 0x0000000000010246 cr2: 0x000000007845de60
Logical CPU: 2
Binary Images:
0x109f0e000 - 0x109f0eff7 +org.python.python (2.7.3 - 2.7.3) <0804FA1A-1971-34AA-9913-3FC9BB92CE7A> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
0x109f15000 - 0x10a045fff +org.python.python (2.7.3, [c] 2004-2012 Python Software Foundation. - 2.7.3) <B25D5152-0A1B-3419-BAEE-56B92BBB359F> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
0x10a2b1000 - 0x10a2c3fff +_ctypes.so (0) <C66B9434-D14E-3093-B03D-71E09FD5AAFB> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
0x10a305000 - 0x10a309ff7 +_struct.so (0) <F3F08FF4-A7E2-38A5-9094-679C44D41449> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_struct.so
0x10a311000 - 0x10a328fff +libgphoto2.dylib (0) <7A03D799-D7F8-30B3-B184-B7CEC6EB774D> /opt/local/lib/libgphoto2.dylib
0x10a395000 - 0x10a39bff7 +libgphoto2_port.10.dylib (0) <C30AC3FD-A181-3A4D-B036-3FEAE01597BE> /opt/local/lib/libgphoto2_port.10.dylib
0x10a3a1000 - 0x10a3a7fff +libltdl.7.dylib (0) <A210C6AD-1D4C-3D4F-82BD-3270657781A2> /opt/local/lib/libltdl.7.dylib
0x10a3ab000 - 0x10a3c9fff +libexif.12.dylib (0) <391084F0-0813-37D3-992A-C4A3AA3FF9D2> /opt/local/lib/libexif.12.dylib
0x10a3e8000 - 0x10a3f0fff +libintl.8.dylib (0) <F50D97C9-83EA-345A-8B23-783FF183FF78> /opt/local/lib/libintl.8.dylib
0x10a3f5000 - 0x10a4edff7 +libiconv.2.dylib (0) <1914316E-52FA-3DC3-9CE7-6D2D71CFD4DB> /opt/local/lib/libiconv.2.dylib
0x10a4fa000 - 0x10a4fdfff +strop.so (0) <EB09700D-9319-384F-8983-0C449C3D3E26> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/strop.so
0x10a502000 - 0x10a503fff +time.so (0) <5576CBB9-504E-356B-8878-684C7E92D26A> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so
0x7fff69b0e000 - 0x7fff69b4293f dyld (210.2.3) <36CAA36E-72BC-3E48-96D9-B96A2DF77730> /usr/lib/dyld
0x7fff826e6000 - 0x7fff826e7ff7 libdnsinfo.dylib (453.18) <E7595861-ECF9-336E-9901-BED2620FAA80> /usr/lib/system/libdnsinfo.dylib
0x7fff82d49000 - 0x7fff82d4cff7 libdyld.dylib (210.2.3) <F59367C9-C110-382B-A695-9035A6DD387E> /usr/lib/system/libdyld.dylib
0x7fff82ff2000 - 0x7fff82ff3fff libsystem_blocks.dylib (59) <D92DCBC3-541C-37BD-AADE-ACC75A0C59C8> /usr/lib/system/libsystem_blocks.dylib
0x7fff83a78000 - 0x7fff83a7afff libquarantine.dylib (52) <4BE2E642-A14F-340A-B482-5BD2AEFD9C24> /usr/lib/system/libquarantine.dylib
0x7fff83e99000 - 0x7fff83ea4fff libsystem_notify.dylib (98.5) <C49275CC-835A-3207-AFBA-8C01374927B6> /usr/lib/system/libsystem_notify.dylib
0x7fff83ea5000 - 0x7fff83ea7ff7 libunc.dylib (25) <92805328-CD36-34FF-9436-571AB0485072> /usr/lib/system/libunc.dylib
0x7fff83ea8000 - 0x7fff840a8fff libicucore.A.dylib (491.11.1) <CC318A27-878A-38CE-9292-1B98353FA9C7> /usr/lib/libicucore.A.dylib
0x7fff858c5000 - 0x7fff85aaefff com.apple.CoreFoundation (6.8 - 744.12) <EF002794-DAEF-31C6-866C-E3E3AC387A9F> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff85ab1000 - 0x7fff85b1afff libstdc++.6.dylib (56) <EAA2B53E-EADE-39CF-A0EF-FB9D4940672A> /usr/lib/libstdc++.6.dylib
0x7fff86092000 - 0x7fff860c0ff7 libsystem_m.dylib (3022.6) <B434BE5C-25AB-3EBD-BAA7-5304B34E3441> /usr/lib/system/libsystem_m.dylib
0x7fff86125000 - 0x7fff8612bfff libmacho.dylib (829) <BF332AD9-E89F-387E-92A4-6E1AB74BD4D9> /usr/lib/system/libmacho.dylib
0x7fff861c7000 - 0x7fff862df92f libobjc.A.dylib (532.2) <90D31928-F48D-3E37-874F-220A51FD9E37> /usr/lib/libobjc.A.dylib
0x7fff863ae000 - 0x7fff863afff7 libremovefile.dylib (23.1) <DBBFAF35-AC78-3856-92F6-6E4FD9DF14A2> /usr/lib/system/libremovefile.dylib
0x7fff86478000 - 0x7fff8648dff7 libdispatch.dylib (228.23) <D26996BF-FC57-39EB-8829-F63585561E09> /usr/lib/system/libdispatch.dylib
0x7fff885fe000 - 0x7fff885fffff libDiagnosticMessagesClient.dylib (8) <8548E0DC-0D2F-30B6-B045-FE8A038E76D8> /usr/lib/libDiagnosticMessagesClient.dylib
0x7fff88991000 - 0x7fff88a5dfe7 libsystem_c.dylib (825.25) <8CBCF9B9-EBB7-365E-A3FF-2F3850763C6B> /usr/lib/system/libsystem_c.dylib
0x7fff88ce3000 - 0x7fff88cf1ff7 libsystem_network.dylib (77.10) <0D99F24E-56FE-380F-B81B-4A4C630EE587> /usr/lib/system/libsystem_network.dylib
0x7fff88e31000 - 0x7fff88e3ffff libcommonCrypto.dylib (60026) <2D6537F5-1B5E-305C-A1CF-D1FA80CA3939> /usr/lib/system/libcommonCrypto.dylib
0x7fff892e0000 - 0x7fff892e8ff7 libsystem_dnssd.dylib (379.32.1) <62AA0B84-188A-348B-8F9E-3E2DB08DB93C> /usr/lib/system/libsystem_dnssd.dylib
0x7fff8abc8000 - 0x7fff8abcffff libcopyfile.dylib (89) <876573D0-E907-3566-A108-577EAD1B6182> /usr/lib/system/libcopyfile.dylib
0x7fff8abd1000 - 0x7fff8abecff7 libsystem_kernel.dylib (2050.18.24) <C0535565-35D1-31A7-A744-63D9F10F12A4> /usr/lib/system/libsystem_kernel.dylib
0x7fff8ae1a000 - 0x7fff8ae69ff7 libcorecrypto.dylib (106.2) <CE0C29A3-C420-339B-ADAA-52F4683233CC> /usr/lib/system/libcorecrypto.dylib
0x7fff8af99000 - 0x7fff8af9aff7 libsystem_sandbox.dylib (220) <3C3B03CF-C525-3CB3-8557-62E91B93AC95> /usr/lib/system/libsystem_sandbox.dylib
0x7fff8bb35000 - 0x7fff8bb81ff7 libauto.dylib (185.1) <73CDC482-16E3-3FC7-9BB4-FBA2DA44DBC2> /usr/lib/libauto.dylib
0x7fff8bcfb000 - 0x7fff8bcfcff7 libSystem.B.dylib (169.3) <9089D72D-E714-31E1-80C8-698A8E8B05AD> /usr/lib/libSystem.B.dylib
0x7fff8c29f000 - 0x7fff8c2a4fff libcompiler_rt.dylib (30) <08F8731D-5961-39F1-AD00-4590321D24A9> /usr/lib/system/libcompiler_rt.dylib
0x7fff8c88b000 - 0x7fff8c891ff7 libunwind.dylib (35.1) <21703D36-2DAB-3D8B-8442-EAAB23C060D3> /usr/lib/system/libunwind.dylib
0x7fff8c919000 - 0x7fff8c92bff7 libz.1.dylib (43) <2A1551E8-A272-3DE5-B692-955974FE1416> /usr/lib/libz.1.dylib
0x7fff8d885000 - 0x7fff8d8edff7 libc++.1.dylib (65.1) <20E31B90-19B9-3C2A-A9EB-474E08F9FE05> /usr/lib/libc++.1.dylib
0x7fff8db96000 - 0x7fff8dbbbff7 libc++abi.dylib (24.4) <E7BD9363-1D25-3551-A68A-2E2FF6ABECD7> /usr/lib/libc++abi.dylib
0x7fff8dbe4000 - 0x7fff8dc1afff libsystem_info.dylib (406.17) <4FFCA242-7F04-365F-87A6-D4EFB89503C1> /usr/lib/system/libsystem_info.dylib
0x7fff8dc1e000 - 0x7fff8dc40ff7 libxpc.dylib (140.41) <FAC04D8B-680E-325F-8F0C-DD69859D0E01> /usr/lib/system/libxpc.dylib
0x7fff8dea5000 - 0x7fff8dea5fff libkeymgr.dylib (25) <CC9E3394-BE16-397F-926B-E579B60EE429> /usr/lib/system/libkeymgr.dylib
0x7fff8e0f5000 - 0x7fff8e0fafff libcache.dylib (57) <65187C6E-3FBF-3EB8-A1AA-389445E2984D> /usr/lib/system/libcache.dylib
0x7fff8e190000 - 0x7fff8e198fff liblaunch.dylib (442.26.2) <2F71CAF8-6524-329E-AC56-C506658B4C0C> /usr/lib/system/liblaunch.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 1774
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=65.5M resident=37.5M(57%) swapped_out_or_unallocated=28.0M(43%)
Writable regions: Total=20.8M written=2496K(12%) resident=3264K(15%) swapped_out=0K(0%) unallocated=17.6M(85%)
REGION TYPE VIRTUAL
=========== =======
MALLOC 12.0M
MALLOC guard page 32K
STACK GUARD 56.0M
Stack 8192K
VM_ALLOCATE 8K
__DATA 1916K
__LINKEDIT 54.0M
__TEXT 11.5M
__UNICODE 544K
shared memory 12K
=========== =======
TOTAL 143.9M
Model: MacBookAir4,2, BootROM MBA41.0077.B0F, 2 processors, Intel Core i7, 1.8 GHz, 4 GB, SMC 1.73f65
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xE9), Broadcom BCM43xx 1.0 (5.106.98.81.22)
Bluetooth: Version 4.0.9f33 10885, 2 service, 11 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM256C, 251 GB
USB Device: FaceTime Camera (Built-in), apple_vendor_id, 0x850a, 0xfa200000 / 3
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x024d, 0xfa120000 / 5
USB Device: BRCM20702 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x821f, 0xfa113000 / 8
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
USB Device: NIKON DSC D50, 0x04b0 (Nikon Corporation), 0x040a, 0xfd120000 / 4
USB Device: Internal Memory Card Reader, apple_vendor_id, 0x8404, 0xfd110000 / 3
Hi! I'm having a memory leak when liveview is running, is there any way to avoid this?
Regards
code:
def liveview():
global main_surface
C = piggyphoto.camera()
C.leave_locked()
C.capture_preview('./Ims/preview.jpg')
picture = pygame.image.load("./Ims/preview.jpg")
pygame.display.set_mode(picture.get_size())
main_surface = pygame.display.get_surface()
pygame.display.set_caption("Vista en Vivo")
while not quit_pressed():
C.capture_preview('./Ims/preview.jpg')
show("./Ims/preview.jpg")
pygame.display.quit()
C.exit()
os.remove("./Ims/preview.jpg")
It seems to be incompatible with debian squeeze python2.7 - something has changed in ctypes maybe?
Error ca be seen whily running python list-config.py :
main.actions.manualfocusdrive =
Traceback (most recent call last):
File "list-config.py", line 5, in <module>
C.list_config()
File "/home/user/devels/dslrPi/piggyphoto/piggyphoto/__init__.py", line 360, in list_config
self._list_config(cfg, cfglist, cfg.name)
File "/home/user/devels/dslrPi/piggyphoto/piggyphoto/__init__.py", line 352, in _list_config
self._list_config(c, cfglist, path + "." + c.name)
File "/home/user/devels/dslrPi/piggyphoto/piggyphoto/__init__.py", line 352, in _list_config
self._list_config(c, cfglist, path + "." + c.name)
File "/home/user/devels/dslrPi/piggyphoto/piggyphoto/__init__.py", line 354, in _list_config
print path, "=", widget.value
File "/home/user/devels/dslrPi/piggyphoto/piggyphoto/__init__.py", line 655, in _get_value
value = ctypes.cast(value.value, ctypes.c_float_p)
AttributeError: 'module' object has no attribute 'c_float_p'
I'm using this lib against a Nikon d90:
gphoto2 --get-config /main/actions/manualfocusdrive
Label: Drive Nikon DSLR Manual focus
Type: RANGE
Current: 0
Bottom: -32767
Top: 32767
Step: 1
Python version: 2.7.3rc2
According to python documentation, there is no such attribute "c_float_p":
http://docs.python.org/2/library/ctypes.html#fundamental-data-types
Thanks for your help !
Cheers,
C.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.