Bitbake the latest Gstreamer in Yocto Morty - gstreamer

I would like to bitbake the latest Gstreamer in Yocto Morty, but the error has occured and could not implement the Gstreamer.
I found the gstreamer 1.12.2 recipe at https://github.com/dv1/meta-gstreamer1.0.
So I put meta-gstreamer1.0 directory in sources directory and add BBLAYERS += " ${BSPDIR}/sources/meta-gstreamer1.0 " to build_fb/bblayers.conf.
Then I bitbaked fsl-image-gui and following errors are occured.
ERROR: /home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12.2.bb: Error executing a python function in <code>:
The stack trace of python calls that resulted in this exception/failure was:
File: '<code>', lineno: 13, function: <module>
0009:__anon_35__home_***_var_fslc_yocto_sources_poky_meta_classes_devshell_bbclass(d)
0010:__anon_108__home_***_var_fslc_yocto_sources_poky_meta_classes_sstate_bbclass(d)
0011:__anon_45__home_***_var_fslc_yocto_sources_poky_meta_classes_blacklist_bbclass(d)
0012:__anon_158__home_***_var_fslc_yocto_sources_poky_meta_classes_siteinfo_bbclass(d)
*** 0013:__anon_30__home_***_var_fslc_yocto_sources_meta_gstreamer1_0_recipes_multimedia_gstreamer_gstreamer1_0_omx_inc(d)
File: '/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc', lineno: 22, function: __anon_30__home_***_var_fslc_yocto_sources_meta_gstreamer1_0_recipes_multimedia_gstreamer_gstreamer1_0_omx_inc
0018:EXTRA_OECONF += "--disable-valgrind --with-omx-target=${GSTREAMER_1_0_OMX_TARGET}"
0019:
0020:python __anonymous () {
0021: omx_target = d.getVar("GSTREAMER_1_0_OMX_TARGET")
*** 0022: if omx_target in ['generic', 'bellagio']:
0023: # Bellagio headers are incomplete (they are missing the OMX_VERSION_MAJOR,#
0024: # OMX_VERSION_MINOR, OMX_VERSION_REVISION, and OMX_VERSION_STEP macros);
0025: # appending a directory path to gst-omx' internal OpenMAX IL headers fixes this
0026: d.appendVar("CFLAGS", " -I${S}/omx/openmax")
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
ERROR: ExpansionError during parsing /home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.2.bb
Traceback (most recent call last):
File "/home/***/var-fslc-yocto/sources/poky/meta/classes/base.bbclass", line 375, in __anon_656__home_***_var_fslc_yocto_sources_poky_meta_classes_base_bbclass(d=<bb.data_smart.DataSmart object at 0x7fb7a8dcff98>):
pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
> pn = d.getVar("PN", True)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 569, in DataSmart.getVar(var='PACKAGECONFIG', expand=True, noweakdefault=False, parsing=False):
def getVar(self, var, expand, noweakdefault=False, parsing=False):
> return self.getVarFlag(var, "_content", expand, noweakdefault, parsing)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 737, in DataSmart.getVarFlag(var='PACKAGECONFIG', flag='_content', expand=True, noweakdefault=False, parsing=False):
cachename = var + "[" + flag + "]"
> value = self.expand(value, cachename)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 410, in DataSmart.expand(s=" ${GSTREAMER_ORC} ${PACKAGECONFIG_GL} ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp ", varname='PACKAGECONFIG'):
def expand(self, s, varname = None):
> return self.expandWithRefs(s, varname).value
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 400, in DataSmart.expandWithRefs(s=" orc gles2 egl ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp ", varname='PACKAGECONFIG'):
except Exception as exc:
> raise ExpansionError(varname, s, exc) from exc
bb.data_smart.ExpansionError: Failure expanding variable PACKAGECONFIG, expression was orc gles2 egl ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp which triggered exception AttributeError: module 'bb.utils' has no attribute 'filter'
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
I found the error "Exception: TypeError: getVar() missing 1 required positional argument: 'expand'" is fixed in Yocto 2.3(Pyro) at https://bugzilla.yoctoproject.org/show_bug.cgi?id=3314.
Furthermore, YP core says gstreamer version for Yocto Morty is 1.8.3 (see https://www.yoctoproject.org/downloads/core/morty22 updates tab).
Do these things mean that we cannot implement gstreamer 1.12.2 or later version in Yocto Morty? Are there any way to do it? Do we have to use Yocto Pyro or later version if we want to implement gstreamer 1.12?
Environment
Yocto Morty (2.2.1) https://github.com/varigit/variscite-bsp-platform/tree/morty#variscite-release-notes
PS:
I rewrite getVar and bitbake proceeded.However I got following error.Would someone help me?
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: The recipe gstreamer1.0-plugins-base is trying to install files into a shared area when those files already exist. Those files and their manifest location are:
/home/***/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib/gstreamer-1.0/libgstrawparse.la
Matched in b'manifest-imx6ul-var-dart-gstreamer1.0-plugins-bad.populate_sysroot'
/home/***/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib/gstreamer-1.0/libgstrawparse.so
Matched in b'manifest-imx6ul-var-dart-gstreamer1.0-plugins-bad.populate_sysroot'
Please verify which recipe should provide the above files.
The build has stopped as continuing in this scenario WILL break things, if not now, possibly in the future (we've seen builds fail several months later). If the system knew how to recover from this automatically it would however there are several different scenarios which can result in this and we don't know which one this is. It may be you have switched providers of something like virtual/kernel (e.g. from linux-yocto to linux-yocto-dev), in that case you need to execute the clean task for both recipes and it will resolve this error. It may be you changed DISTRO_FEATURES from systemd to udev or vice versa. Cleaning those recipes should again resolve this error however switching DISTRO_FEATURES on an existing build directory is not supported, you should really clean out tmp and rebuild (reusing sstate should be safe). It could be the overlapping files detected are harmless in which case adding them to SSTATE_DUPWHITELIST may be the correct solution. It could also be your build is including two different conflicting versions of things (e.g. bluez 4 and bluez 5 and the correct solution for that would be to resolve the conflict. If in doubt, please ask on the mailing list, sharing the error and filelist above.
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: Function failed: sstate_task_postfunc
ERROR: Logfile of failure stored in: /home/***/var-fslc-yocto/build_fb/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/gstreamer1.0-plugins-base/1.12.2-r0/temp/log.do_populate_sysroot.99466
ERROR: Task (/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb:do_populate_sysroot) failed with exit code '1'
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_package: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:split_gstreamer10_packages(d)
0003:
File: '/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gst-plugins-package.inc', lineno: 6, function: split_gstreamer10_packages
0002:PACKAGESPLITFUNCS_append = " set_metapkg_rdepends "
0003:
0004:python split_gstreamer10_packages () {
0005: gst_libdir = d.expand('${libdir}/gstreamer-${LIBV}')
*** 0006: postinst = d.getVar('plugin_postinst')
0007: glibdir = d.getVar('libdir')
0008:
0009: do_split_packages(d, glibdir, '^lib(.*)\.so\.*', 'lib%s', 'gstreamer %s library', extra_depends='', allow_links=True)
0010: do_split_packages(d, gst_libdir, 'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer plugin for %s', postinst=postinst, extra_depends='')
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_package: Function failed: split_gstreamer10_packages
ERROR: Logfile of failure stored in: /home/***/var-fslc-yocto/build_fb/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/gstreamer1.0-plugins-base/1.12.2-r0/temp/log.do_package.99465
ERROR: Task (/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb:do_package) failed with exit code '1'

Since you are migrating recipe for older version of Yocto into a newer, you must be facing consequences of this change in Yocto: expand parameter (the second one) to getVar() and getVarFlag() has become mandatory (from bitbake user manual for morty), previously it was defaulted to False. So, you should correct all occurrences of these operations and add at least False as a second argument.

Related

`nix-build` fails because Python wants something that's unavailable, without saying what it wants

(At least I think that's the problem.)
The error
When I run nix-build -A serialosc from the root of nixpkgs, nix prints the following:
[jeff#jbb-dell:~/nix/nixpkgs-fork]$ nix-build -A serialosc
these derivations will be built:
/nix/store/p40wvn28grb8nrcd6scbxhhjqw4495kk-serialosc.drv
building '/nix/store/p40wvn28grb8nrcd6scbxhhjqw4495kk-serialosc.drv'...
unpacking sources
unpacking source archive /nix/store/5zj802wfjd0ima92lpzzsqdjqvrnrwf9-serialosc
source root is serialosc
patching sources
configuring
configure flags: --prefix=/nix/store/b6qzvzmwjdi29nnzc769904wc0mj1cds-serialosc configure
Setting top to : /build/serialosc
Setting out to : /build/serialosc/build
Checking for 'gcc' (C compiler) : gcc
Checking for working poll() : yes
Checking for libudev : yes
Checking for libmonome : yes
Checking for liblo : yes
Checking for function strdup : yes
Checking for function _strdup : not found
Checking for function strndup : yes
Checking for function strcasecmp : yes
Checking for header unistd.h : yes
Checking for header dns_sd.h : yes
Checking for library dl : yes
Traceback (most recent call last):
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Scripting.py", line 103, in waf_entry_point
run_commands()
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Scripting.py", line 164, in run_commands
ctx=run_command(cmd_name)
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Scripting.py", line 155, in run_command
ctx.execute()
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Configure.py", line 92, in execute
super(ConfigurationContext,self).execute()
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Context.py", line 92, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File "/build/serialosc/.waf-1.8.5-3fc7b0f5070c04bfd3f2489448471a84/waflib/Context.py", line 133, in recurse
user_function(self)
File "/build/serialosc/wscript", line 259, in configure
stderr=devnull).decode().strip()
File "/nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py", line 216, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
builder for '/nix/store/p40wvn28grb8nrcd6scbxhhjqw4495kk-serialosc.drv' failed with exit code 2
error: build of '/nix/store/p40wvn28grb8nrcd6scbxhhjqw4495kk-serialosc.drv' failed
[jeff#jbb-dell:~/nix/nixpkgs-fork]$
My suspicion
The problem appears to arise in lib/python2.7/subprocess.py. I found a version of that file online, and the definition of _execute_child seems to make reference to some absolute paths -- for instance, in this passage:
if shell:
args = ["/bin/sh", "-c"] + args
if executable:
args[0] = executable
Therefore my guess is that Nix is building in a sandbox that doesn't offer whatever Python expects. But the error doesn't tell me what Python was hoping to find.
The context
(You might not need this information.)
I'm trying to build serialosc on NixOS 19.09. Here's my fork of nixpkgs, including my broken recipe for serialosc. The fork also includes my libmonome package, which works, and which serialosc depends on, and which is not yet part of the official nixpkgs repo. I've given hard links to the specific commit; they shouldn't change when I update the fork.
Cross-posting from
https://discourse.nixos.org/t/nix-build-fails-because-python-wants-something-thats-unavailable-without-saying-what-it-wants/5675/2
so that it could help people who only find this, answer might continue on NixOS discourse. I tried to keep it helpful for general NixOS writing a derivation debugging, with some Python bits
fetchgit
First, let's help with the fetchgit part in your recipe
src = fetchgit {
# Once, it seemed to finish, and I don't know how! Then it crashed with:
# Switched to a new branch 'fetchgit'
# removing `.git'...
# hash mismatch in fixed-output derivation '/nix/store/5zj802wfjd0ima92lpzzsqdjqvrnrwf9-serialosc':
# wanted: sha256:1vqcxi32wc4pklbddllflkaigkfvd4ykwrjqccayvrk10dx1sna3
# got: sha256:1zmzjasv21ix7i7s58a31k0025ji32hv2jm2ww6s0xhjmr5ax34j
# This way it [[gets pretty far]].
# The fetchSubmodules value I set again seems to have no effect.
url = https://github.com/monome/serialosc.git;
rev = "v1.4.1";
sha256 = "1zmzjasv21ix7i7s58a31k0025ji32hv2jm2ww6s0xhjmr5ax34j";
Perhaps there was a force push? Not sure why it would stop working with the hash
I found that the fetchSubmodules has no effect if you have the hash of the one without the submodules, use nix-prefetch-git --fetch-submodules https://github.com/monome/serialosc which gives
{
"url": "https://github.com/monome/serialosc",
"rev": "cec0ea76b2d5f69afa74d3ffc14a0950e32a7914",
"date": "2019-06-09T21:46:13+02:00",
"sha256": "03qkzslhih72idwafgfxmkwp5v3x048njh0c682phw2ks11plmbp",
"fetchSubmodules": true
}
so use
fetchgit {
url = https://github.com/monome/serialosc;
rev = "cec0ea76b2d5f69afa74d3ffc14a0950e32a7914";
# or rev = version; but that might break with force pushes
sha256 = "03qkzslhih72idwafgfxmkwp5v3x048njh0c682phw2ks11plmbp";
fetchSubmodules = true;
}
wafHook
There is a (slight) wafHook documentation in https://nixos.org/nixpkgs/manual/
Debugging error
It seems to want to do git stuff, here is how I debugged it:
$ nix-shell https://github.com/JeffreyBenjaminBrown/nixpkgs/archive/2bbd131811991bec9ae6b296b5cd1441640c306c.tar.gz -A serialosc --pure
nix-shell $ mkdir /tmp/delme-serialosc
nix-shell $ cd !$
# To find out what a build would do
nix-shell $ type genericBuild
...
# Doing the `if [ -z "${phases:-}" ]; then ...` bit gives us `echo $phases`
# unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase fixupPhase installCheckPhase distPhase
nix-shell $ ${unpackPhase:-unpackPhase}
nix-shell $ cd $sourceRoot
nix-shell $ ${patchPhase:-patchPhase}
nix-shell $ ${configurePhase:-configurePhase}
# Error happens here
nix-shell $ type ${configurePhase:-configurePhase}
# Do the steps until you find it stops in `python ...`
# Python debug info: https://docs.python.org/3/library/pdb.html
nix-shell $ python -m pdb "$wafPath" "${flagsArray[#]}";
(Pdb) continue # or cont, or just c
...
(Pdb) break /nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py:1047
(Pdb) continue
> /nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py(1047)_execute_child()
-> raise child_exception
(Pdb) up
> /nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py(394)__init__()
-> errread, errwrite)
(Pdb) # empty is equivalent to do last command, i.e. up in this case
> /nix/store/lbrpma3528hq7gwn8ffbnwaxvsqah0bb-python-2.7.17/lib/python2.7/subprocess.py(216)check_output()
-> process = Popen(stdout=PIPE, *popenargs, **kwargs)
(Pdb) print(popenargs)
(['git', 'rev-parse', '--verify', '--short', 'HEAD'],)
But you will find you might need to figure a way to avoid waf using git as it cannot access the network unless it's a fixed-output derivation (e.g. those fetching sources). Hopefully the bit about fetchSubmodules will fix it!
Edit: I didn’t read past that it tries to use git, it tries to figure out what version it is, you should somehow make it avoid using git to do that, e.g. grep -r 'rev-parse' suggests editing the wscript file
Edit 2: E.g. something like
--- wscript-old 2020-01-29 15:55:54.100976818 +0000
+++ wscript 2020-01-29 15:55:58.128977024 +0000
## -257,7 +257,7 ##
conf.env.GIT_COMMIT = subprocess.check_output(
["git", "rev-parse", "--verify", "--short", "HEAD"],
stderr=devnull).decode().strip()
- except subprocess.CalledProcessError:
+ except (subprocess.CalledProcessError, OSError):
conf.env.GIT_COMMIT = ''
conf.define("VERSION", VERSION)
perhaps it could be upstreamed too (this leaves the git commit ID as empty in this case)? Or just use substituteInPlace or something to put in the actual commit ID to be
--- wscript-old 2020-01-29 15:55:54.100976818 +0000
+++ wscript 2020-01-29 15:57:56.177983054 +0000
## -249,16 +249,7 ##
conf.env.VERSION = VERSION
- try:
- import os
-
- devnull = open(os.devnull, 'w')
-
- conf.env.GIT_COMMIT = subprocess.check_output(
- ["git", "rev-parse", "--verify", "--short", "HEAD"],
- stderr=devnull).decode().strip()
- except subprocess.CalledProcessError:
- conf.env.GIT_COMMIT = ''
+ conf.env.GIT_COMMIT = 'cec0ea76b2d5f69afa74d3ffc14a0950e32a7914'
conf.define("VERSION", VERSION)
conf.define("_GNU_SOURCE", 1)

Running stem with tor gives "Process terminated: Timed out"

While trying to run Stem's To Russia With Love example, I am getting the following error:
~$ python practice.py
Starting Tor:
Traceback (most recent call last):
File "practice.py", line 49, in <module>
init_msg_handler = print_bootstrap_lines,
File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 266, in launch_tor_with_config
return launch_tor(tor_cmd, args, torrc_path, completion_percent, init_msg_handler, timeout, take_ownership)
File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 143, in launch_tor
raise OSError('Process terminated: %s' % last_problem)
OSError: Process terminated: Timed out
I was initially getting the path error that was solved over here. I tried restarting the Ubuntu instance (I am running Ubuntu 14.04 in VirtualBox) just in case if any other running tor was conflicting but its giving the same error. Could anyone please help?
EDIT: My torrc file also seems to be empty right now if this is in any way connected.
It might be failing because you are missing the GeoIP database which is required to use an exit node from a specific country.
Try removing the 'ExitNodes': '{ru}', line from the python script, or since you're on Ubuntu, try sudo apt-get install tor-geoipdb and see if that helps get the connection up and running.
Since it takes time to build the circuits, you can try increasing the timeout a bit as well (though this probably isn't why its failing).
tor_process = stem.process.launch_tor_with_config(
#tor_cmd = '/usr/bin/tor',
timeout = 300,
config = {
'SocksPort': str(SOCKS_PORT),
# 'ExitNodes': '{ru}',
'DataDir': '/tmp/tor',
'Log': [
'NOTICE file /tmp/tor.notice.log',
'ERR file /tmp/tor.log',
],
},
init_msg_handler = print_bootstrap_lines,
)

Creating a single executable .exe from Python script that uses PuLP

I have been struggling with this for a while. I have used py2exe and cx_freeze to package everything. I am using a 32 bit machine and Everything works fine and the interface opens up and everything just that I know the entire puLP package is not being copied correctly into the package. I know this because the solver does not work. Inside both library zips in the packages created by py2exe and cx_freeze, there are only .pyc files included where PuLP has cbc.exe and other file types that make the solver work.
Is there any work around this? I have tried copying the actual PuLP package into the library.zip as well as into the dist folder and that didn't work.
Here is the setup I used for py2exe:
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["pulp"],
"icon": "icon.ico",
"include_files": ["icon.ico","cbc.exe","cbc-32","cbc-64","cbc-osx-64","CoinMP.dll"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "my_app",
version = "0.1",
options = {"build_exe": build_exe_options},
executables = [Executable("my_app.py", base=base)])
I received the following error:
Exception in Tkinter callback
Traceback (most recent call last):
File "Tkinter.pyc", line 1470, in __call__
File "my_app.py", line 796, in <lambda>
File "my_app.py", line 467, in branchAndBound
File "pulp\pulp.pyc", line 1619, in solve
AttributeError: 'NoneType' object has no attribute 'actualSolve'
EDIT
I tried to change the paths to cbc.exe and CoinMP.dll but that didn't really work either. I am probably missing something.
I changed the following inside solvers.py in the PuLP package:
try:
coinMP_path = config.get("locations", "CoinMPPath").split(', ')
except configparser.Error:
coinMP_path = ['/Users/al/Desktop/my_app/build/exe.win32-2.7']
try:
cbc_path = config.get("locations", "CbcPath")
except configparser.Error:
cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'
try:
pulp_cbc_path = config.get("locations", "PulpCbcPath")
except configparser.Error:
pulp_cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'
What am I missing or doing wrong?

Crash on Nite initialisation in python program written using primesense2.2.0.30-5

I am using Ubunut 14.04 and have installed OpenNI 2.2, NITE 2.2 and primesense2.2.0.30-5 (https://pypi.python.org/pypi/primesense/2.2.0.30-5)
The sample program mentioned at the above site works quite well however when I am trying to use initialize nite2 the program crashes.
Here is the code:
from primesense import openni2, nite2
openni2.initialize() # can also accept the path of the OpenNI redistribution
nite2.initialize()
if (nite2.is_initialized()):
print "nite2 initialized"
else:
print "nite2 not initialized"
dev = openni2.Device.open_any()
print dev.get_sensor_info(openni2.SENSOR_DEPTH)
depth_stream = dev.create_depth_stream()
depth_stream.start()
frame = depth_stream.read_frame()
frame_data = frame.get_buffer_as_uint16()
depth_stream.stop()
openni2.unload()
Error Report :
Traceback (most recent call last):
File "test.py", line 4, in <module>
nite2.initialize()
File "/usr/local/lib/python2.7/dist-packages/primesense/nite2.py", line 81, in initialize
("\n ".join("%s: %s" % (dir, ex) for dir, ex in exceptions)),)
primesense.utils.InitializationError: NiTE2 could not be loaded:
/home/user/project/kinect/NiTE-Linux-x64-2.2/Samples/Bin/libNiTE2.so: /home/user/project/kinect/NiTE-Linux-x64-2.2/Samples/Bin/libNiTE2.so: undefined symbol: niteDumpUserTrackerCalibrationDataToFile
OpenNI2-FreenectDriver: Closing device freenect://0
I want nite python bindings for user tracking and hand tracking . Did anyone done it before successfully
A workaround is to comment the following lines in file _openni2.py from the primesense python bindings:
global _niteDumpUserTrackerCalibrationDataToFile
_niteDumpUserTrackerCalibrationDataToFile = dll.niteDumpUserTrackerCalibrationDataToFile
_niteDumpUserTrackerCalibrationDataToFile.restype = NiteStatus
_niteDumpUserTrackerCalibrationDataToFile.argtypes = [NiteUserTrackerHandle, NiteUserId, ctypes.c_char_p]
Also, make sure you have a copy/symlink of both the NiTE2 library and folder (Redist/NiTE2 in the archive) in the same directory as your python script.

Error with GDAL

I have tried and run this script from Rutger Kassies.
import gdal
import matplotlib.pyplot as plt
ds = gdal.Open('HDF4_SDS:sample:"A2002037045000.L2_LAC.SAMPLE.hdf":01')
data = ds.ReadAsArray()
ds = None
fig, ax = plt.subplots(figsize=(6,6))
ax.imshow(data[0,:,:], cmap=plt.cm.Greys, vmin=1000, vmax=6000)
But then an error always occured:
Traceback (most recent call last):
File "D:\path\to\python\stackoverflow.py", line 5, in <module>
data = ds.ReadAsArray()
AttributeError: 'NoneType' object has no attribute 'ReadAsArray'
What's wrong with the script? Am I missing something? In installing GDAL I have followed this instruction http://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/
Am using windows 7/32 bit/Python 2.7.
Thanks!
gdal.Open() is failing and returning 'None'. This produces the sometimes counterintuitive message "NoneType' object has no attribute ...". Quoting from Python: Attribute Error - 'NoneType' object has no attribute 'something', "NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. That usually means that an assignment or function call up above failed or returned an unexpected result."
Apparently GDAL is correctly installed. It could be that the file is not readable or that there is an issue with the HDF driver. Are you getting any error message like:
`HDF4_SDS:sample:"A2002037045000.L2_LAC.SAMPLE.hdf":01' does not
exist in the file system, and is not recognised as a supported dataset
name.
To get additional information you can try something like this instead of the gdal.Open() line in your script:
gdal.UseExceptions()
ds=None
try:
ds = gdal.Open('HDF4_SDS:sample:"A2002037045000.L2_LAC.SAMPLE.hdf":01')
except RuntimeError, err:
print "Exception: ", err
exit(1)
Also, there's an extra '}' at the end of the script.
By default, osgeo.gdal returns None on error, and does not normally raise informative exceptions. You can change this with gdal.UseExceptions().
Try something like this:
from osgeo import gdal
gdal.UseExceptions()
source_path = r'HDF4_SDS:sample:"D:\path\to\file\A2002037045000.L2_LAC.SAMPLE.hdf":01'
try:
ds = gdal.Open(source_path)
except RuntimeError as ex:
raise IOError(ex)
The last bit just re-raises the exception as an IOError rather than a RuntimeException.
The solution is to modify source_path to a working path to your data source, e.g., I see
IOError: `HDF4_SDS:sample:"A2002037045000.L2_LAC.SAMPLE.hdf":01' does not exist in the file system, and is not recognised as a supported dataset name.