[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: calling python script from exported bash function, module import fai
From: |
Ole Tange |
Subject: |
Re: calling python script from exported bash function, module import fails |
Date: |
Fri, 23 Dec 2016 01:24:42 +0100 |
On Thu, Dec 22, 2016 at 5:28 PM, Benjamin Leutner
<benjamin.leutner@uni-wuerzburg.de> wrote:
> Here's the modified example:
>
> function FUN {
> echo -e "\n----- Try number: ${1} -----"
> echo "Host: $(hostname), Level: $SHLVL"
> python -c "
> import setuptools
> print 'import succesful'"
> }
> export -f FUN
>
> # without env
> parallel 'FUN {}' ::: 1
>
> # with env for function
> parallel --env FUN 'FUN {}' ::: 2
>
> # with env for everything
> parallel --env _ 'FUN {}' ::: 3
All work for me. So this is a local problem on your machine.
Therefore see if you can reproduce the error on one of these
VirtualBox images:
http://sourceforge.net/projects/virtualboximage/files/
http://www.osboxes.org/virtualbox-images/
> 1) is fine, 2) and 3) give me :
> Traceback (most recent call last):
> File "<string>", line 2, in <module>
> File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 14,
> in <module>
> from setuptools.extension import Extension
> File "/usr/lib/python2.7/dist-packages/setuptools/extension.py", line 10,
> in <module>
> from .dist import _get_unpatched
> File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 22, in
> <module>
> from setuptools import windows_support
> File "/usr/lib/python2.7/dist-packages/setuptools/windows_support.py",
> line 11, in <module>
> @windows_only
> File "/usr/lib/python2.7/dist-packages/setuptools/windows_support.py",
> line 6, in windows_only
> if platform.system() != 'Windows':
> File "/usr/lib/python2.7/platform.py", line 1286, in system
> return uname()[0]
> File "/usr/lib/python2.7/platform.py", line 1253, in uname
> processor = _syscmd_uname('-p','')
> File "/usr/lib/python2.7/platform.py", line 988, in _syscmd_uname
> rc = f.close()
> IOError: [Errno 10] No child processes
The traceback indicates Python tries to run system("uname", "-p"), but
fails due to no child process.
/Ole