Pytest use set_log_path to create log file for each test failed? - pytest

I used the pytest hook logging-plugins's set_log_path to create different log for each test, it failed with [Errno 32] Broken pipe when executing .py file, it work fine when only execute the test one by one.
The error message as below:
item =
#pytest.hookimpl()
def pytest_runtest_setup(item):
logging_plugin = item.config.pluginmanager.get_plugin("logging-plugin")
date = datetime.strftime(datetime.now(), '%Y-%m-%d')
path = 'logs'
# file_path = os.path.join(path, date, f'{item.name}.log')
# file = open(file_path, 'w+')
# file.close()
logging_plugin.set_log_path(os.path.join(path, date, f'{item.name}.log'))
test_suites/conftest.py:24:
/usr/lib/python3.8/logging/init.py:1105: in setStream
self.flush()
self = <_FileHandler /dev/null (DEBUG)>
def flush(self):
"""
Flushes the stream.
"""
self.acquire()
try:
if self.stream and hasattr(self.stream, "flush"):
self.stream.flush()
E BrokenPipeError: [Errno 32] Broken pipe
/usr/lib/python3.8/logging/init.py:1065: BrokenPipeError ERR
========================================================================================================================= short test summary info ==========================================================================================================================ERROR test_suites/test_modbus_tcp.py::test_modbus_tcp_client_read_discrete_inputs - BrokenPipeError: [Errno 32] Broken pipe
ERROR test_suites/test_modbus_tcp.py::test_modbus_tcp_client_read_input_registers - BrokenPipeError: [Errno 32] Broken pipe
ERROR test_suites/test_modbus_tcp.py::test_modbus_tcp_client_read_write_multiple_holding_registers - BrokenPipeError: [Errno 32] Broken pipe

Related

Bitbake do image failure

I have been successfully building an image for many days now. I add all of my custom files to GitLab. I have not knowingly made changes to my build environment. I am now getting errors can can not build my image. Can anyone understand what this error is telling me? I have tried looking it up but nothing seems to work.
Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:06
Sstate summary: Wanted 5 Local 3 Network 0 Missed 2 Current 1114 (60% match, 99% complete)
NOTE: Executing Tasks
ERROR: evccapplication-1.0-r0 do_image: 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:do_image(d)
0003:
File: '/home/michael/Documents/evcc_custom/sources/poky/meta/classes/image.bbclass', lineno: 262, function: do_image
0258:
0259: d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
0260: pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
0261:
*** 0262: execute_pre_post_process(d, pre_process_cmds)
0263:}
0264:do_image[dirs] = "${TOPDIR}"
0265:addtask do_image after do_rootfs
0266:
File: '/home/michael/Documents/evcc_custom/sources/poky/meta/lib/oe/utils.py', lineno: 263, function: execute_pre_post_process
0259: for cmd in cmds.strip().split(';'):
0260: cmd = cmd.strip()
0261: if cmd != '':
0262: bb.note("Executing %s ..." % cmd)
*** 0263: bb.build.exec_func(cmd, d)
0264:
0265:# For each item in items, call the function 'target' with item as the first
0266:# argument, extraargs as the other arguments and handle any exceptions in the
0267:# parent thread
File: '/home/michael/Documents/evcc_custom/sources/poky/bitbake/lib/bb/build.py', lineno: 256, function: exec_func
0252: with bb.utils.fileslocked(lockfiles):
0253: if ispython:
0254: exec_func_python(func, d, runfile, cwd=adir)
0255: else:
*** 0256: exec_func_shell(func, d, runfile, cwd=adir)
0257:
0258: try:
0259: curcwd = os.getcwd()
0260: except:
File: '/home/michael/Documents/evcc_custom/sources/poky/bitbake/lib/bb/build.py', lineno: 503, function: exec_func_shell
0499: with open(fifopath, 'r+b', buffering=0) as fifo:
0500: try:
0501: bb.debug(2, "Executing shell function %s" % func)
0502: with open(os.devnull, 'r+') as stdin, logfile:
*** 0503: bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
0504: except bb.process.ExecutionError as exe:
0505: # Find the backtrace that the shell trap generated
0506: backtrace_marker_regex = re.compile(r"WARNING: Backtrace \(BB generated script\)")
0507: stdout_lines = (exe.stdout or "").split("\n")
File: '/home/michael/Documents/evcc_custom/sources/poky/bitbake/lib/bb/process.py', lineno: 186, function: run
0182:
0183: if pipe.returncode != 0:
0184: if log:
0185: # Don't duplicate the output in the exception if logging it
*** 0186: raise ExecutionError(cmd, pipe.returncode, None, None)
0187: raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
0188: return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/home/michael/Documents/evcc_custom/build-fb/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/evccapplication/1.0-r0/temp/run.prelink_image.131394' failed with exit code 2
ERROR: Logfile of failure stored in: /home/michael/Documents/evcc_custom/build-fb/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/evccapplication/1.0-r0/temp/log.do_image.131394
ERROR: Task (/home/michael/Documents/evcc_custom/evcc_layers/meta-evccapplication/recipes-core/images/evccapplication.bb:do_image) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3064 tasks of which 3063 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/michael/Documents/evcc_custom/evcc_layers/meta-evccapplication/recipes-core/images/evccapplication.bb:do_image
Summary: There were 2 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
If you get an error similar to this delete your build folder. Then recreate it. For NXP devices they give you the command
DISTRO=fsl-imx-fb MACHINE=imx6ull14x14evk source imx-setup-release.sh -b build-fb
Save your local.conf and bblayers.bb file to git or to a new location.
Delete the build-fb folder and re-run the command above. Pull in any changes from git or files saved elsewhere.
Re-run bitbake. This got my workspace back. Because you are not deleting any of the downloads folders the build takes little time. All the time is spent compiling sources.

ERROR: YoctoProject - core-image-sato: do_populate_sdk

I am a beginner in Yocto project. I am trying to build the image for Beaglebone Black Board with command-line: bitbake core-image-sato -c populate_sdk and I had an error (the detail in the below) in last task.
Enviroment build: Ubuntu 16.04 LTS, using Bash Shell instead of Dash Shell.
I tried to build again many times but still facing same error. Anybody can help me to fix this error?
Log file:
NOTE: Executing create_sdk_files ...
DEBUG: Executing shell function create_sdk_files
DEBUG: Shell function create_sdk_files finished
NOTE: Executing check_sdk_sysroots ...
DEBUG: Executing python function check_sdk_sysroots
DEBUG: Python function check_sdk_sysroots finished
NOTE: Executing archive_sdk ...
DEBUG: Executing shell function archive_sdk
/home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/run.archive_sdk.4392: line 106: 11617 Broken pipe tar --owner=root --group=root -cf - .
11618 Killed | xz -T 0 -9 > /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/x86_64-deploy-core-image-sato-populate-sdk/poky-glibc-x86_64-core-image-sato-armv7at2hf-neon-beaglebone-toolchain-3.0.tar.xz
WARNING: /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/run.archive_sdk.4392:1 exit 137 from 'xz -T 0 -9 > /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/x86_64-deploy-core-image-sato-populate-sdk/poky-glibc-x86_64-core-image-sato-armv7at2hf-neon-beaglebone-toolchain-3.0.tar.xz'
ERROR: 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:do_populate_sdk(d)
0003:
File: '/home/huongnguyen/Desktop/poky/openembedded-core/meta/classes/populate_sdk_base.bbclass', lineno: 169, function: do_populate_sdk
0165:
0166: populate_sdk(d)
0167:
0168:fakeroot python do_populate_sdk() {
*** 0169: populate_sdk_common(d)
0170:}
0171:SSTATETASKS += "do_populate_sdk"
0172:SSTATE_SKIP_CREATION_task-populate-sdk = '1'
0173:do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}"
File: '/home/huongnguyen/Desktop/poky/openembedded-core/meta/classes/populate_sdk_base.bbclass', lineno: 166, function: populate_sdk_common
0162: manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST)
0163: create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
0164: manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET)
0165:
*** 0166: populate_sdk(d)
0167:
0168:fakeroot python do_populate_sdk() {
0169: populate_sdk_common(d)
0170:}
File: '/home/huongnguyen/Desktop/poky/openembedded-core/meta/lib/oe/sdk.py', lineno: 413, function: populate_sdk
0409: env_bkp = os.environ.copy()
0410:
0411: img_type = d.getVar('IMAGE_PKGTYPE')
0412: if img_type == "rpm":
*** 0413: RpmSdk(d, manifest_dir).populate()
0414: elif img_type == "ipk":
0415: OpkgSdk(d, manifest_dir).populate()
0416: elif img_type == "deb":
0417: DpkgSdk(d, manifest_dir).populate()
File: '/home/huongnguyen/Desktop/poky/openembedded-core/meta/lib/oe/sdk.py', lineno: 60, function: populate
0056: self.sysconfdir, "ld.so.cache")
0057: self.mkdirhier(os.path.dirname(link_name))
0058: os.symlink("/etc/ld.so.cache", link_name)
0059:
*** 0060: execute_pre_post_process(self.d, self.d.getVar('SDK_POSTPROCESS_COMMAND'))
0061:
0062: def movefile(self, sourcefile, destdir):
0063: try:
0064: # FIXME: this check of movefile's return code to None should be
File: '/home/huongnguyen/Desktop/poky/openembedded-core/meta/lib/oe/utils.py', lineno: 260, function: execute_pre_post_process
0256: for cmd in cmds.strip().split(';'):
0257: cmd = cmd.strip()
0258: if cmd != '':
0259: bb.note("Executing %s ..." % cmd)
*** 0260: bb.build.exec_func(cmd, d)
0261:
0262:# For each item in items, call the function 'target' with item as the first
0263:# argument, extraargs as the other arguments and handle any exceptions in the
0264:# parent thread
File: '/home/huongnguyen/Desktop/poky/bitbake/lib/bb/build.py', lineno: 249, function: exec_func
0245: with bb.utils.fileslocked(lockfiles):
0246: if ispython:
0247: exec_func_python(func, d, runfile, cwd=adir)
0248: else:
*** 0249: exec_func_shell(func, d, runfile, cwd=adir)
0250:
0251: try:
0252: curcwd = os.getcwd()
0253: except:
File: '/usr/lib/python3.5/contextlib.py', lineno: 77, function: __exit__
0073: # Need to force instantiation so we can reliably
0074: # tell if we get the same exception back
0075: value = type()
0076: try:
*** 0077: self.gen.throw(type, value, traceback)
0078: raise RuntimeError("generator didn't stop after throw()")
0079: except StopIteration as exc:
0080: # Suppress StopIteration *unless* it's the same exception that
0081: # was passed to throw(). This prevents a StopIteration
File: '/home/huongnguyen/Desktop/poky/bitbake/lib/bb/utils.py', lineno: 431, function: fileslocked
0427: if files:
0428: for lockfile in files:
0429: locks.append(bb.utils.lockfile(lockfile))
0430:
*** 0431: yield
0432:
0433: for lock in locks:
0434: bb.utils.unlockfile(lock)
0435:
File: '/home/huongnguyen/Desktop/poky/bitbake/lib/bb/build.py', lineno: 249, function: exec_func
0245: with bb.utils.fileslocked(lockfiles):
0246: if ispython:
0247: exec_func_python(func, d, runfile, cwd=adir)
0248: else:
*** 0249: exec_func_shell(func, d, runfile, cwd=adir)
0250:
0251: try:
0252: curcwd = os.getcwd()
0253: except:
File: '/home/huongnguyen/Desktop/poky/bitbake/lib/bb/build.py', lineno: 450, function: exec_func_shell
0446: with open(fifopath, 'r+b', buffering=0) as fifo:
0447: try:
0448: bb.debug(2, "Executing shell function %s" % func)
0449: with open(os.devnull, 'r+') as stdin, logfile:
*** 0450: bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
0451: finally:
0452: os.unlink(fifopath)
0453:
0454: bb.debug(2, "Shell function %s finished" % func)
File: '/home/huongnguyen/Desktop/poky/bitbake/lib/bb/process.py', lineno: 182, function: run
0178: if not stderr is None:
0179: stderr = stderr.decode("utf-8")
0180:
0181: if pipe.returncode != 0:
*** 0182: raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
0183: return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/run.archive_sdk.4392' failed with exit code 137:
/home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/run.archive_sdk.4392: line 106: 11617 Broken pipe tar --owner=root --group=root -cf - .
11618 Killed | xz -T 0 -9 > /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/x86_64-deploy-core-image-sato-populate-sdk/poky-glibc-x86_64-core-image-sato-armv7at2hf-neon-beaglebone-toolchain-3.0.tar.xz
WARNING: /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/run.archive_sdk.4392:1 exit 137 from 'xz -T 0 -9 > /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/x86_64-deploy-core-image-sato-populate-sdk/poky-glibc-x86_64-core-image-sato-armv7at2hf-neon-beaglebone-toolchain-3.0.tar.xz'
ERROR: Logfile of failure stored in: /home/huongnguyen/Desktop/poky/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato/1.0-r0/temp/log.do_populate_sdk.4392
ERROR: Task (/home/huongnguyen/Desktop/poky/openembedded-core/meta/recipes-sato/images/core-image-sato.bb:do_populate_sdk) failed with exit code '1'
Exit code 137 means something killed xz during the build. You may be running out of memory: check dmesg after this happens, there might be a log line about out-of-memory killer.
Had the same problem and could make it go away with XZ_MEMLIMIT="75%" bitbake image-name -c do_populate_sdk. The bitbake.conf in my version of Yocto defaults XZ_MEMLIMIT to 50%.
Had the same problem and none of the usual methods, like, deleting hidden repo file worked.
I then clean the build using bitbake -c clean mybuildname and then again made the build and it worked flawlessly, I hope it helps someone.

Yocto update to Sumo with Multilib results in error in do_image_wic

After the update to Yocto 2.5 Sumo my genericx86 build doesn't work anymore. The problem seems to be with the Multilib feature. I need the 64 bit version of grub-efi so I've added this to my local.conf:
require conf/multilib.conf
MULTILIBS = "multilib:lib64"
DEFAULTTUNE_virtclass-multilib-lib64 = "x86-64"
IMAGE_INSTALL_append = " lib64-grub-efi"
With Sumo I get this error:
image-dev-1.0-r0 do_image_wic: 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:extend_recipe_sysroot(d)
0003:
File: '/workdir/poky/build-x86/../meta/classes/staging.bbclass', lineno: 546, function: extend_recipe_sysroot
0542: bb.note("Skipping as already exists in sysroot: %s" % str(msg_exists))
0543:
0544: for f in fixme:
0545: if f == '':
*** 0546: staging_processfixme(fixme[f], recipesysroot, recipesysroot, recipesysrootnative, d)
0547: elif f == 'native':
0548: staging_processfixme(fixme[f], recipesysrootnative, recipesysroot, recipesysrootnative, d)
0549: else:
0550: staging_processfixme(fixme[f], multilibs[f].getVar("RECIPE_SYSROOT"), recipesysroot, recipesysrootnative, d)
File: '/workdir/poky/build-x86/../meta/classes/staging.bbclass', lineno: 174, function: staging_processfixme
0170: for fixmevar in ['COMPONENTS_DIR', 'HOSTTOOLS_DIR', 'PKGDATA_DIR', 'PSEUDO_LOCALSTATEDIR', 'LOGFIFO']:
0171: fixme_path = d.getVar(fixmevar)
0172: cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
0173: bb.debug(2, cmd)
*** 0174: subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
0175:
0176:
0177:def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
0178: import glob
File: '/usr/lib/python3.5/subprocess.py', lineno: 626, function: check_output
0622: # empty string. That is maintained here for backwards compatibility.
0623: kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b''
0624:
0625: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
*** 0626: **kwargs).stdout
0627:
0628:
0629:class CompletedProcess(object):
0630: """A process that has finished running.
File: '/usr/lib/python3.5/subprocess.py', lineno: 708, function: run
0704: raise
0705: retcode = process.poll()
0706: if check and retcode:
0707: raise CalledProcessError(retcode, process.args,
*** 0708: output=stdout, stderr=stderr)
0709: return CompletedProcess(process.args, retcode, stdout, stderr)
0710:
0711:
0712:def list2cmdline(seq):
Exception: subprocess.CalledProcessError: Command 'sed -e 's:^[^/]*/:/workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/recipe-sysroot/:g' /workdir/poky/build-x86/tmp/sysroots-components/x86_64/lib64-libtool-cross/fixmepath /workdir/poky/build-x86/tmp/sysroots-components/core2-32/libtool-cross/fixmepath | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:/workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/recipe-sysroot:g; s:FIXMESTAGINGDIRHOST:/workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/recipe-sysroot-native:g' -e 's:FIXME_COMPONENTS_DIR:/workdir/poky/build-x86/tmp/sysroots-components:g' -e 's:FIXME_HOSTTOOLS_DIR:/workdir/poky/build-x86/tmp/hosttools:g' -e 's:FIXME_PKGDATA_DIR:/workdir/poky/build-x86/tmp/pkgdata/genericx86:g' -e 's:FIXME_PSEUDO_LOCALSTATEDIR:/workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/pseudo/:g' -e 's:FIXME_LOGFIFO:/workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/temp/fifo.20324:g'' returned non-zero exit status 123
Subprocess output:
sed: can't read /workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/recipe-sysroot/usr/bin/crossscripts/x86_64-pokymllib64-linux-libtool: No such file or directory
ERROR: image-dev-1.0-r0 do_image_wic: Function failed: extend_recipe_sysroot
ERROR: Logfile of failure stored in: /workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/temp/log.do_image_wic.20324
ERROR: Task (/workdir/poky/build-x86/../meta-general/recipes-devtools/images/image-dev.bb:do_image_wic) failed with exit code '1'
The file x86_64-pokymllib64-linux-libtool is in genericx86-pokymllib64-linux/image-dev/1.0-r0/lib64-recipe-sysroot/usr/bin/crossscripts/. If I copy it over just to see what happens, another error pops up:
ERROR: image-dev-1.0-r0 do_image_wic: 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:extend_recipe_sysroot(d)
0003:
File: '/workdir/poky/build-x86/../meta/classes/staging.bbclass', lineno: 539, function: extend_recipe_sysroot
0535: dest = newmanifest[l]
0536: if l.endswith("/"):
0537: staging_copydir(l, targetdir, dest, seendirs)
0538: continue
*** 0539: staging_copyfile(l, targetdir, dest, postinsts, seendirs)
0540:
0541: bb.note("Installed into sysroot: %s" % str(msg_adding))
0542: bb.note("Skipping as already exists in sysroot: %s" % str(msg_exists))
0543:
File: '/workdir/poky/build-x86/../meta/classes/staging.bbclass', lineno: 151, function: staging_copyfile
0147: os.symlink(linkto, dest)
0148: #bb.warn(c)
0149: else:
0150: try:
*** 0151: os.link(c, dest)
0152: except OSError as err:
0153: if err.errno == errno.EXDEV:
0154: bb.utils.copyfile(c, dest)
0155: else:
Exception: FileExistsError: [Errno 17] File exists: '/workdir/poky/build-x86/tmp/sysroots-components/x86_64/lib64-glibc/sysroot-providers/virtual_lib64-libc' -> '/workdir/poky/build-x86/tmp/work/genericx86-pokymllib64-linux/image-dev/1.0-r0/lib64-recipe-sysroot/sysroot-providers/virtual_lib64-libc'
ERROR: image-dev-1.0-r0 do_image_wic: Function failed: extend_recipe_sysroot
ERROR: Logfile of failure stored in: /workdir/poky/build-x86/tmp/work/genericx86-poky-linux/image-dev/1.0-r0/temp/log.do_image_wic.20412
ERROR: Task (/workdir/poky/build-x86/../meta-general/recipes-devtools/images/image-dev.bb:do_image_wic) failed with exit code '1'
Did something fundamentally change with Multilib in Sumo? I scanned the manual but it seems that I don't have to do anything different than before.
When I comment the Multilib lines from the local.config it builds without errors.

passthru() + Pipe in subprocess = Traceback (most recent call last): (…) in stdout=subprocess.PIPE)

I've got an error when I'm using passthru() to call a python script (using subprocess and pipe) with PHP.
Here is the error:
Traceback (most recent call last):
File "…/Desktop/h.py", line 11, in stdout=subprocess.PIPE)
#set up the convert command and direct the output to a pipe
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 1079, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
The PHP passthru:
<?php
passthru("/usr/bin/python2.5 /Users/Nagar/Desktop/h.py $argument1 $argument2 1 2>&1");
?>
My Python line which cause the error:
p1 = subprocess.Popen(['convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE) #set up the convert command and direct the output to a pipe
How to use stdout=subprocess.PIPE properly in the subprocess?
Looking forward your answers.
It looks like your PATH doesn't have the directory including the "convert" command. Try replacing:
p1 = subprocess.Popen(['convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE)
with:
p1 = subprocess.Popen(['/full/path/to/convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE)
where "/full/path/to/convert" might be something like "/usr/bin/convert".
It's because it needs to be executed through a shell, so you need to set shell argument to True:
p1 = subprocess.Popen(['convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE, shell=True)convert command and direct the output to a pipe

parallel-python error: RuntimeError("Socket connection is broken")

I am using a simple program to send a function:
import pp
nodes=('mosura02','mosura03','mosura04','mosura05','mosura06',
'mosura09','mosura10','mosura11','mosura12')
nodes=('miner:60001',)
def pptester():
js=pp.Server(ppservers=nodes)
js.set_ncpus(0)
tmp=[]
for i in range(200):
tmp.append(js.submit(ppworktest,(),(),('os',)))
return tmp
def ppworktest():
import os
return os.system("uname -a")
the result is:
wkerzend#mosura:/home/wkerzend/tmp/ppython_test>ssh miner "source ~/coala_python_setup.sh;ppserver.py -d -p 60001"
2010-04-12 00:50:48,162 - pp - INFO - Creating server instance (pp-1.6.0)
2010-04-12 00:50:52,732 - pp - INFO - pp local server started with 32 workers
2010-04-12 00:50:52,732 - pp - DEBUG - Strarting network server interface=0.0.0.0 port=60001
Exception in thread client_socket:
Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 525, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.6/threading.py", line 477, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/wkerzend/python_coala/bin/ppserver.py", line 161, in crun
ctype = mysocket.receive()
File "/home/wkerzend/python_coala/lib/python2.6/site-packages/pptransport.py", line 178, in receive
raise RuntimeError("Socket connection is broken")
RuntimeError: Socket connection is broken