Could not open camera using gphoto2 in python - python-3.x

I try to control a Sony Alpha using Python/gphoto2 on a Raspberry PI. I've tried a number of python bindings (python-gphoto2, gphoto2-cffi, ...) but they all fail at the instruction to create a camera object (eg. my_cam = gphoto.Camera()) with the error:
"Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device."
We tried to kill background programs, make sure the kernel modules are not running, install the latest versions of the libraries and python packages, ... but could not get rid of the error. Furthermore C code using libgphoto2 works fine so it's not likely that the resource is really busy. We suspect the problem is missing USB libs in the python packages, and have tried to install libusb-dev, ... but it doesn't help.
Any suggestions what else we should try? Thanks.

You mentioned trying python-gphoto2. I'm the author of that package. Assuming you have installed it successfully then I'd try the list-cameras.py example program. It should list any cameras recognised by libgphoto2 that are connected and switched on.
If C programs are working but Python ones aren't you could check that they're using the same versions of libgphoto2. Try ldd on the C program's executable and on one of the python-gphoto2 compiled modules, e.g. /usr/local/lib/python3.5/dist-packages/gphoto2/_camera.cpython-35m-arm-linux-gnueabihf.so.

Related

teamviewer quick connect button with qt creator

first, i am using centos 6.9, and qt creator 3.0.0
I am able to connect with server using terminal directly with command
/usr/bin/teamviewer -i [serverid] -P [password]"
then i was implement it to a button in qt with this code :
system("gnome-terminal --hide-menubar --profile=noclose -x bash -c '/usr/bin/teamviewer -i [serverid] -P [password];'");
but thats not work, it show this error :
Init...
CheckCPU: SSE2 support: yes
XRandRWait: No value set. Using default.
XRandRWait: Started by user.
Checking setup...
/opt/teamviewer/tv_bin/wine/bin/wineserver: Symbol `wine_casemap_upper' has different size in shared object, consider re-linking
/opt/teamviewer/tv_bin/wine/bin/wineserver: Symbol `wine_casemap_lower' has different size in shared object, consider re-linking
Launching TeamViewer ...
/opt/teamviewer/tv_bin/wine/bin/wineserver: Symbol `wine_casemap_upper' has different size in shared object, consider re-linking
/opt/teamviewer/tv_bin/wine/bin/wineserver: Symbol `wine_casemap_lower' has different size in shared object, consider re-linking
Launching TeamViewer GUI ...
i am also tried with different method using Qprocess .start .execute, still no luck.
I just resolved it myself.
i have installed wine in system and i guess i have deleted it correctly, but not.
it happened because I am not deleted all wine commponent correctly.
i just remove wine with yum remove wine,then it solved with yum remove wine*.
btw thanks to #nwp to change my tag question to wine and teamviewer only. Thats make me to recheck the wine package on my system.

Adding kernel module to Debian

I have imx6-quad and Debian Jessie installed on it. Here is the full info about (uname -a):
Linux linaro-alip 4.1.15-g5599520 #1 SMP PREEMPT Sun Jan 8 13:03:20 IST 2017 armv7l GNU/Linux
I'm trying to run tunslip application for CC1350 Launchpad, but there is no kernel module "tun" in my OS. When I run command modprobe tun, I given an error:
modprobe: FATAL: Module tun not found.
At this point, I don't know how to install tun module to my Debian. I even don't know where to start. Is it possible to add tun module to running operation system or should I compile whole kernel from scratch? If I can add kernel module, how could I add to running OS?
Any help is too precious for me.
So, to sum up the discussion in the comments in case someone else will come here with the same problem:
Unfortunately, the precompiled kernel image provided by Variscite here doesn't come with tun support at all. Neither in modules nor compiled into the kernel.
If you want tun support, you will have to compile the kernel in your own. Sources can be found here on github.
Previous Answer:
Since I'm not allowed to comment yet, please take this less as an answer but more as a suggestion where to look for a solution.
What does the following command give you?
cat /boot/config-4.1.15-g5599520 | grep CONFIG_TUN
It should say CONFIG_TUN=m. If it doesn't, it may be that your kernel already supports tun devices.
Have you tried searching for tunmodules in /lib/modules? If not, run
find /lib/modules/ -name '*tun.ko*'
and let us know what it gives you.
as you are building your kernel. there are a couple of methods one is to compile the module separately and to install it on the existing image. The other is to create the tun module along with the kernel and the sdcard image creation will take care of your module.
TO build tun module. use menuconfig from the kernel folder. search for something matching to CONFIG_TUN if its is a module change its value to m. Rebuild and create the sdcard again. This is the easy way.
You can also craete the module separately and then bring the module to your filesystem but that can be more error prone.

Install node-serialport module on arm-linux

I have been using node-serialport on my linux X86 machine and it works great. Now I am trying to install node-serialport on an embedded platform running arm linux. I managed to cross compile the node itself and able to run node/npm on the target platform.
However, simply running npm install serialport does not work:
binary not available for your platform
and then npm launches the build using node-gyp. Unfortunately the build requires Python which is not available on my embedded platform (tried to cross compile python without success :( )
Can anyone please help me to cross-compile serial port on my linux machine? I have tried a lot of methods on the web but all of them failed for one reason or the other
I managed to do the cross-compile serial port finally, using ugliest of methods :) Following is the method that worked:
On native x86 linux box,
cd <your work area>
Setup the cross_compiler tool environment variables:
export AR=arm-marvell-linux-gnueabi-ar
export CC=arm-marvell-linux-gnueabi-gcc
export CXX=arm-marvell-linux-gnueabi-g++
export LINK=arm-marvell-linux-gnueabi-g++
export npm_config_arch=arm
export npm_config_nodedir=/home/ysoni/node
Now run npm install. Please note that since npm install insisted that I should compile 64bit package,so I had to provide manually --package_name, --hosted_path etc. I got those params from serialport website.
npm install serialport --arch=x64 --target_arch=arm --remote_path=./serialport/v1.4.0/Release/ --package_name=node-v11-linux-ia32.tar.gz --staged_tarball=build/stage/serialport/v1.4.0/Release/node-v11-linux-ia32.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/node-v11-linux-ia32.tar.gz
A node_modules directory will be generated that contains .bin and serialport folders.
Now, copy the contents of node_modules to your target_platform.
I wrote a sample .js script to test if serial device could be opened. The script has to be in the same directory as node_modules.
Expectedly there has to be one last roadblock !! Weird enough, I had to do some renaming. This may not be necessary for your platform:
busybox mv node_modules/serialport/build/serialport/v1.4.2/Release/node-v11-linux-arm/ node_modules/serialport/build/serialport/v1.4.2/Release/v8-3.11-linux-arm/
In the end, I am able to open the serialport and ready contents. I really hope that there is easier way out there !
Happy hacking !!
For anybody who comes across this post (I know it's old) as of version 5.x you CAN build for ARM directly on the device, say a Raspberry Pi for example.
I just don't want developers who want to use this library to be turned off by the notion of having to cross compile because as we all know, it's a pain!

SIP install - unable to open siplib.sbf

I'm trying to install SIP on my computer so I can proceed to get PyQt. I put the install files in a folder on my desktop ('C:\Users\User\Desktop\Programming\Sip\sip-4.15.5'). So, to install it, I ran the following commands from CMD:
cd C:\Python33
python "C:\Users\User\Desktop\Programming\Sip\sip-4.15.5\configure.py"
The version of python in 'C:\Python33' IS the one used in the command 'python'. Here's the output I got:
This is SIP 4.15.5 for Python 3.3.5 on win32.
The SIP code generator will be installed in C:\Python33.
The sip module will be installed in C:\Python33\Lib\site-packages.
The sip.h header file will be installed in C:\Python33\include.
The default directory to install .sip files in is C:\Python33\sip.
The platform/compiler configuration is win32-msvc2010.
Creating siplib\sip.h...
Creating siplib\siplib.c...
Creating siplib\siplib.sbf...
Creating sipconfig.py...
Creating top level Makefile...
Creating sip code generator Makefile...
Creating sip module Makefile...
Error: Unable to open
"C:\Users\User\Desktop\Programming\Sip\sip-4.15.5\siplib\siplib.sbf"
Now, the key lines are obviously the last two, so I looked in the appropriate folder and found that there was a rather good reason for the error: there is no "siplib.sbf." The closest it gets is "siplib.sbf.in". What on earth is going on? If this is a stupid question, please feel free to tell me so.
You must change current working directory to the sip-4.15.5 first:
cd C:\Users\User\Desktop\Programming\Sip\sip-4.15.5
python configure.py

Problem between PyQt5 and Cocoa under MacOSX with PyInstaller

I installed OSX Mavericks to make sure that the application I'm developing can run on this system. I compile with PyInstaller (my build script that uses PYInstaller runs without errors).
The problem is that when I double-click on the executable, I get this error:
Last login: Wed Jan 16 22:56:18 on ttys004
Mac-Pro-de-angelo:~ angelo$ /Users/angelo/miniconda3/envs/apsc/apsc_1_0_0_onefile_mac_osx/apsc ; exit;
objc[5125]: Class RunLoopModeTracker is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class NotificationReceiver is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPageLayoutDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPrintPanelDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f9362f5b620) is not the object's thread (0x7f93640b2370).
Cannot move to target thread (0x7f9362f5b620)
You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".
Available platform plugins are: cocoa, minimal, offscreen.
Reinstalling the application may fix this problem.
Abort trap: 6
logout
[Opération terminée]
If I refer to this post:
pyinstaller + pyqt5: could not find or load "cocoa"
I encounter the same problem but the proposed solution does not work not at my house.
That's how my PYInstaller script is run:
/Users/angelo/miniconda3/envs/apsc/bin/pyinstaller --clean --windowed --onefile --runtime-tmpdir /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T --icon=logo_apsc_256x256.icns --distpath apsc_1_0_0_onefile_mac_osx --name apsc apsc_gui.py
For accuracy my software works fine under MacOSX when launched directly from Python.
Can you help me find a solution?
These are my specifications:
MacOSX 10.9.5
Python 3.4.5, qt-5.6.2, sip-4.18 and pyqt-5.6.0 under Miniconda3-3.8.3
... After ...
I would really like to solve this problem, it's been several days ... and I can not do it.
It has evolved a little but I still have errors and it is still impossible for me to launch my software (the, generated app) under MacOSX after compilation with PyInstaller,
That's what I did:
A symbolic link between libpython3.6m.dylib and libpython3.6.dylib (the latter did not exist in the bin directory of the environment created in miniconda3):
ln -s /Users/angelo/miniconda3/envs/test/lib/libpython3.6m.dylib /Users/angelo/miniconda3/envs/test/lib/libpython3.6.dylib
Then I placed the order:
export DYLD_PRINT_RPATHS=1
It should be noted that I find myself with the error:
21966 ERROR: Can not find path ./libtbb.dylib (needed by /Users/angelo/miniconda3/envs/test/lib/libmkl_tbb_thread.dylib)
The result is a little better but I always find myself with the errors:
objc[2619]: Class RunLoopModeTracker is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[2619]: Class NotificationReceiver is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7ff483848540) is not the object's thread (0x7ff48385ab60).
Cannot move to target thread (0x7ff483848540)
... which I can not get rid of.
If anyone could help me, I'd be really happy,
Help me please.

Resources