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

ImportError: No module named _list #36

Closed
Nic2012 opened this issue Oct 8, 2017 · 5 comments
Closed

ImportError: No module named _list #36

Nic2012 opened this issue Oct 8, 2017 · 5 comments

Comments

@Nic2012
Copy link

Nic2012 commented Oct 8, 2017

Hi, great stuff here and I would like to try it on a new RaspberryPI 3 distro pi64 https://github.com/bamarni/pi64.

Installed libgphoto 2.5.15 based on http://blog.marcelkrauskopfphotography.de/category/raspberry-pi/
Installed python-gphoto by sudo pip install -v gphoto2 without problems.

...
  Removing source in /tmp/pip-build-OjKwUf/gphoto2
Successfully built gphoto2
Installing collected packages: gphoto2

Successfully installed gphoto2-1.7.1
Cleaning up...

lsusb gives me

Bus 001 Device 006: ID 04b0:0422 Nikon Corp. D700 (ptp)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But running the example return exceptions:

root@pi64:/home/pi# python /usr/local/share/python-gphoto2/examples/camera-summary.py
Traceback (most recent call last):
  File "/usr/local/share/python-gphoto2/examples/camera-summary.py", line 25, in <module>
    import gphoto2 as gp
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/__init__.py", line 3, in <module>
    from gphoto2.abilities_list import *
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/abilities_list.py", line 6, in <module>
    import gphoto2.context
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/context.py", line 6, in <module>
    import gphoto2.list
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/list.py", line 17, in <module>
    _list = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/list.py", line 16, in swig_import_helper
    return importlib.import_module('_list')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _list

Using Python 2.7.13 and libgphoto2-2.5.15.

Any ideas would be appreciated. Best regards,
Nic

@jim-easterbrook
Copy link
Owner

The _list module is the compiled C code and should be in the same directory as the Python module list.py. What's in the directory /usr/local/lib/python2.7/dist-packages/gphoto2/?

@Nic2012
Copy link
Author

Nic2012 commented Oct 8, 2017

Later I have installed some other python stuff and libudev etc. and afterwards it runs fine, not sure what was really missing, the content is currently:

pi@pi64:~$ ls /usr/local/lib/python2.7/dist-packages/gphoto2
abilities_list.py   camera.pyc   _context.so  filesys.py   __init__.pyc  port_info_list.py   port_log.pyc  _result.so   widget.py
abilities_list.pyc  _camera.so   file.py      filesys.pyc  list.py       port_info_list.pyc  _port_log.so  version.py   widget.pyc
_abilities_list.so  context.py   file.pyc     _filesys.so  list.pyc      _port_info_list.so  result.py     version.pyc  _widget.so
camera.py           context.pyc  _file.so     __init__.py  _list.so      port_log.py         result.pyc    _version.so

I guess thats looks ok. Strange thing is on this distro I have to call the commands by sudo, no matter if its python-gphoto2 or the regular gphoto2 cli.

pi@pi64:~$ python /usr/local/share/python-gphoto2/examples/camera-summary.py
WARNING: gphoto2: (gp_libusb1_open [libusb1.c:392]) 'libusb_open (port->pl->d, &port->pl->dh)' failed: Access denied (insufficient permissions) (-3)
Traceback (most recent call last):
  File "/usr/local/share/python-gphoto2/examples/camera-summary.py", line 60, in <module>
    sys.exit(main())
  File "/usr/local/share/python-gphoto2/examples/camera-summary.py", line 33, in main
    gp.check_result(gp.gp_camera_init(camera, context))
  File "/usr/local/lib/python2.7/dist-packages/gphoto2/result.py", line 162, in check_result
    raise GPhoto2Error(error)
gphoto2.GPhoto2Error: [-7] I/O problem

@Nic2012 Nic2012 closed this as completed Oct 8, 2017
@jim-easterbrook
Copy link
Owner

The sudo requirement is possibly because of permissions on the USB port. You might need to add your regular user to a USB group, or add a udev rule to change the permissions.

@Nic2012
Copy link
Author

Nic2012 commented Oct 9, 2017

Yeah, that makes sense, thank y for y support.

@jim-easterbrook
Copy link
Owner

For future reference: I've just discovered (while experimenting with MSYS2 on Windows) that installing libtool can cure some module loading problems.

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

2 participants