Comments (28)
Which version of libgphoto2 do you have? Which version of python-gphoto2? How did you install python-gphoto2?
from python-gphoto2.
libgphoto2-2.5.16
Installed it using git + SWIG.
from python-gphoto2.
Ah, I didn't expect that. Which SWIG version?
from python-gphoto2.
To my surprise I've managed to reproduce this bug - it's caused by not using the SWIG -builtin
flag so I guess you're still on SWIG 2.0.11.
from python-gphoto2.
This bug was introduced in commit 24b861a, so only affects release v1.8.1. Temporary solution is to install v1.8.0, or install using pip
so you get code built with the -builtin
flag (which is generally a lot better anyway).
from python-gphoto2.
OK. I started from scratch and installed via pip. Now I get this error:
File "libgphoto_example.py", line 1, in
import gphoto2 as gp
File "/usr/local/lib/python2.7/dist-packages/gphoto2/init.py", line 17, in
from gphoto2.abilities_list import *
File "/usr/local/lib/python2.7/dist-packages/gphoto2/abilities_list.py", line 9, in
import gphoto2.camera
File "/usr/local/lib/python2.7/dist-packages/gphoto2/camera.py", line 10, in
import gphoto2.context
File "/usr/local/lib/python2.7/dist-packages/gphoto2/context.py", line 11, in
import gphoto2.file
File "/usr/local/lib/python2.7/dist-packages/gphoto2/file.py", line 12, in
import gphoto2.filesys
File "/usr/local/lib/python2.7/dist-packages/gphoto2/filesys.py", line 13, in
import gphoto2.list
File "/usr/local/lib/python2.7/dist-packages/gphoto2/list.py", line 14, in
import gphoto2.port_info_list
File "/usr/local/lib/python2.7/dist-packages/gphoto2/port_info_list.py", line 15, in
import gphoto2.port_log
File "/usr/local/lib/python2.7/dist-packages/gphoto2/port_log.py", line 16, in
import gphoto2.result
File "/usr/local/lib/python2.7/dist-packages/gphoto2/result.py", line 17, in
import gphoto2.version
File "/usr/local/lib/python2.7/dist-packages/gphoto2/version.py", line 31, in
_version = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/gphoto2/version.py", line 30, in swig_import_helper
return importlib.import_module('_version')
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: No module named _version
from python-gphoto2.
This looks like the installer either didn't run properly or you're picking up remnants of a previous installation. (I think this can happen because the Python parts of the python-gphoto2 package have older dates in the pip download than the ones you made when you installed from git.) Try sudo rm -rf /usr/local/lib/python2.7/dist-packages/gphoto2*
to wipe all previous installations before installing again.
from python-gphoto2.
OK. I get the same error. I am using python 2.7.6 if this makes a difference.
from python-gphoto2.
What's the output of ls -l /usr/local/lib/python2.7/dist-packages/gphoto2/
?
from python-gphoto2.
total 3628
-rw-r--r-- 1 root staff 3683 Jan 2 17:35 abilities_list.py
-rw-r--r-- 1 root staff 4129 Jan 2 17:35 abilities_list.pyc
-rwxr-xr-x 1 root staff 368600 Jan 2 17:35 _abilities_list.so
-rw-r--r-- 1 root staff 3580 Jan 2 17:35 camera.py
-rw-r--r-- 1 root staff 4057 Jan 2 17:35 camera.pyc
-rwxr-xr-x 1 root staff 578940 Jan 2 17:35 _camera.so
-rw-r--r-- 1 root staff 3591 Jan 2 17:35 context.py
-rw-r--r-- 1 root staff 4066 Jan 2 17:35 context.pyc
-rwxr-xr-x 1 root staff 262902 Jan 2 17:35 _context.so
-rw-r--r-- 1 root staff 3552 Jan 2 17:35 file.py
-rw-r--r-- 1 root staff 4039 Jan 2 17:35 file.pyc
-rwxr-xr-x 1 root staff 346463 Jan 2 17:35 _file.so
-rw-r--r-- 1 root staff 3597 Jan 2 17:35 filesys.py
-rw-r--r-- 1 root staff 4066 Jan 2 17:35 filesys.pyc
-rwxr-xr-x 1 root staff 509335 Jan 2 17:35 _filesys.so
-rw-r--r-- 1 root staff 750 Jan 2 17:35 __init__.py
-rw-r--r-- 1 root staff 1230 Jan 2 17:35 __init__.pyc
-rw-r--r-- 1 root staff 3552 Jan 2 17:35 list.py
-rw-r--r-- 1 root staff 4039 Jan 2 17:35 list.pyc
-rwxr-xr-x 1 root staff 276840 Jan 2 17:35 _list.so
-rw-r--r-- 1 root staff 3683 Jan 2 17:35 port_info_list.py
-rw-r--r-- 1 root staff 4129 Jan 2 17:35 port_info_list.pyc
-rwxr-xr-x 1 root staff 276241 Jan 2 17:35 _port_info_list.so
-rw-r--r-- 1 root staff 4706 Jan 2 17:35 port_log.py
-rw-r--r-- 1 root staff 5282 Jan 2 17:35 port_log.pyc
-rwxr-xr-x 1 root staff 162291 Jan 2 17:35 _port_log.so
-rw-r--r-- 1 root staff 4810 Jan 2 17:35 result.py
-rw-r--r-- 1 root staff 5296 Jan 2 17:35 result.pyc
-rwxr-xr-x 1 root staff 180092 Jan 2 17:35 _result.so
-rw-r--r-- 1 root staff 3590 Jan 2 17:35 version.py
-rw-r--r-- 1 root staff 4066 Jan 2 17:35 version.pyc
-rwxr-xr-x 1 root staff 132604 Jan 2 17:35 _version.so
-rw-r--r-- 1 root staff 3580 Jan 2 17:35 widget.py
-rw-r--r-- 1 root staff 4057 Jan 2 17:35 widget.pyc
-rwxr-xr-x 1 root staff 476221 Jan 2 17:35 _widget.so
from python-gphoto2.
That looks OK - the .so
compiled modules are there, so should be being found. Can you run ldd
on one of the .so
files to see if any required libraries are missing?
from python-gphoto2.
linux-vdso.so.1 => (0x00007fffb0d16000)
libgphoto2.so.6 => /usr/lib/x86_64-linux-gnu/libgphoto2.so.6 (0x00007f38c3cfd000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f38c3adf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f38c3715000)
libgphoto2_port.so.10 => /usr/lib/x86_64-linux-gnu/libgphoto2_port.so.10 (0x00007f38c350b000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f38c3301000)
libexif.so.12 => /usr/lib/x86_64-linux-gnu/libexif.so.12 (0x00007f38c30bc000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f38c2db6000)
/lib64/ld-linux-x86-64.so.2 (0x000055e7d3cd9000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f38c2bb2000)
from python-gphoto2.
So no problem there then. I'm running out of ideas now. Perhaps try the previous version:
sudo pip uninstall gphoto2
sudo pip install gphoto2==1.8.0
from python-gphoto2.
Looks like it installed ok. But using one of your examples, I get this issue now.
WARNING: gphoto2: (gp_port_serial_close [unix.c:465]) Invalid parameters: 'path' is NULL/FALSE.
WARNING: gphoto2: (gp_context_error) Could not detect any camera
Traceback (most recent call last):
File "libgphoto_example.py", line 49, in
sys.exit(main())
File "libgphoto_example.py", line 34, in main
gp.check_result(gp.gp_camera_init(camera))
File "/usr/local/lib/python2.7/dist-packages/gphoto2/result.py", line 165, in check_result
raise GPhoto2Error(error)
gphoto2.GPhoto2Error: [-105] Unknown model
If I use python to talk to gphoto2 using subprocess and the same camera, I get no such errors and I can access the camera.
from python-gphoto2.
gphoto2.GPhoto2Error: [-105] Unknown model is the usual response when there's no camera plugged in (or switched on). The first warning message is typical libgphoto2 verbosity, not really an error. The second is also saying there's no camera.
PS I'm very sorry about the difficulty you had installing. There's definitely a problem with v1.8.1 which hadn't showed up in my testing, but which I'm sure is fixed in 24b861a. It may not have shown up in my tests because of initialisation order being indeterminate, but I don't really know.
from python-gphoto2.
Thanks for your help anyway. Looks like I will have to skip using python-gphoto altogether, gphoto2 detects my camera no problems. I don't know why none of the examples provided with this module detects any of my cameras.
from python-gphoto2.
That's very strange. gphoto2 is using the exact same library so I'm surprised the examples are failing.
from python-gphoto2.
The one thing in common is:
WARNING: gphoto2: (gp_port_serial_close [unix.c:465]) Invalid parameters: 'path' is NULL/FALSE.
from python-gphoto2.
There was something similar in #18 which was never resolved (as far as I know). I assume you're running gphoto2 as the same user so it shouldn't be a permissions problem. Other things to check are that gvfs or similar isn't taking ownership of the usb port, but I'd expect that to upset gphoto2 as well. (You could also run ldd on the gphoto2 executable to check it really is using the same library, but I doubt this is the problem.)
from python-gphoto2.
PS Is your camera visible to the list-cameras.py example? If so, can you select it with the choose-camera.py example?
from python-gphoto2.
There is a difference in the outputs, mostly use the same .so but there is one difference:
gphoto2 uses:
libgphoto2_port.so.10 => /usr/lib/x86_64-linux-gnu/libgphoto2_port.so.10 (0x00007fb50a2df000)
python-gphoto2 uses:
libgphoto2_port.so.12 => /usr/local/lib/libgphoto2_port.so.12 (0x00007f7ee70b5000)
from python-gphoto2.
It is the list-cameras.py example I am using!
from python-gphoto2.
That looks as if gphoto2 was installed by your package manager (the library is in /usr/lib/x86_64-linux-gnu
) whereas python-gphoto2 is picking up a version in /usr/local/lib
. Can you try removing any gphoto2 related stuff from /usr/local/lib
and then do a new gphoto2 install (with pip - it should pick up the new v1.8.2) so it uses the package manager's libgphoto2.
from python-gphoto2.
OK removed everything. Re-compiled libghoto2 from github and reinstalled python-gphoto2 using pip. Use list-cameras.py, same error.
WARNING: gphoto2: (gp_port_serial_close [unix.c:465]) Invalid parameters: 'path' is NULL/FALSE.
from python-gphoto2.
I'm not convinced that warning (see source here https://github.com/gphoto/libgphoto2/blob/master/libgphoto2_port/serial/unix.c#L443) has any bearing on the failure to detect your camera - I suspect you'd see it from the gphoto2 programme if you turn on verbose debugging.
You say you compiled libghoto2 from github - why? It would be easier to get python-gphoto2 working with the system libgphoto2 before you start rolling your own.
from python-gphoto2.
OK. So the problem turns out to be an out of date system libgphoto2!
I once again removed everything, then used the updater script which is floating around (the one which doesn't remove ubuntu-desktop and wine), and it works as expected.
The issue is the fact that with Ubuntu 14.10 LTS if you use the apt-get to install libgphoto2-dev it is dependant upon libgphoto2_port.so.10
It is now using:
gphoto2 2.5.15 gcc, popt(m), exif, no cdk, no aa, jpeg, no readline
libgphoto2 2.5.15 all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0 iolibs: disk ptpip serial usb usbdiskdirect usbscsi, gcc, ltdl, USB, serial without locking
from python-gphoto2.
Just to confirm - you've got gphoto2 and python-gphoto2 using the same libs (as reported by ldd) and both able to detect your cameras?
from python-gphoto2.
Yes, that is correct! Problem solved.
from python-gphoto2.
Related Issues (20)
- delete a file HOT 2
- gp_camera_get_single_config HOT 2
- Socket error after gp_camera_exit in windows/msys2 HOT 15
- Faster way to copy files from camera HOT 7
- Sony FX3 overshoot HOT 1
- `delete_file()` does not delete file HOT 9
- Segmentation Fault segfault on gp.Camera.autodetect() on Github Actions Runner HOT 21
- LGPL vs. GPL license? HOT 8
- Test Virtual Camera HOT 4
- Missing bindings for gp_port_new, gp_port_open, and gp_port_reset? HOT 2
- capture_preview() broken in v2.5.0 HOT 4
- having trouble getting gphoto2 on rpi HOT 3
- use python-gphoto2 in Windows system HOT 1
- Always connected capture anytime HOT 1
- Github Actions Python 3.12 environment. HOT 1
- Is live data acquisition available in the library? HOT 1
- Error When Installing with "Local" libgphoto2 HOT 2
- Missing libgphoto2.so symbols, library is not loaded HOT 17
- "gp_result_as_string not defined" & "gphoto2 has no attribute check_result" since mid-july '24? HOT 4
- Error 2002 on query HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-gphoto2.