parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Combining --pipe and --shebang options


From: Michel Samia
Subject: Re: Combining --pipe and --shebang options
Date: Tue, 27 Nov 2012 12:36:02 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

On 27.11.2012 11:53, Ole Tange wrote:
On Tue, Nov 27, 2012 at 10:25 AM, Michel Samia
<michel.samia@firma.seznam.cz> wrote:
:
Thank you very much for the new functionality.
If you like GNU Parallel:

* Post the intro videos on Reddit/Diaspora*/forums/blogs/
   Identi.ca/Google+/Twitter/Facebook/Linkedin/mailing lists
* Get the merchandise https://www.gnu.org/s/parallel/merchandise.html
* Give a demo at your local user group
* Request or write a review for your favourite blog or magazine
* Request or build a package for your favourite distribution (if it is
not already there)
* Invite me for your next conference (Contact http://ole.tange.dk)

If you use GNU Parallel for research:

* Please cite GNU Parallel in you publications (use --bibtex)

If GNU Parallel saves you money:

* (Have your company) donate to FSF https://my.fsf.org/donate/

Unfortunately I wasn't able
to reproduce the expected behaviour of this script simple.py

#!/usr/local/bin/parallel --shebang-wrap --pipe -k -j24 /usr/bin/python
# should work like cat
import sys

for line in sys.stdin:
     sys.stdout.write(line)

When I run

     echo 'bla' | ./simple.py

sometimes it hangs and my mouse cursor changes its shape to s cross and
sometimes it prints error messages:

michel@bellatrix:/tmp$ echo bla | ./simple.py
./simple2.py: line 6: syntax error near unexpected token `sys.stdout.write'
./simple2.py: line 6: `    sys.stdout.write(line)'

which probably means that the script is run by bash, not by Python.
That is odd. I just tried using your exact program on two different
systems (Ubuntu and Debian) and it works for me. That leads me to
believe it is a local problem on your system.

It would be good if others could test your script, too.

On your system please try creating a new user and run the same as the
new user. Hopefully that will give you a clean environment.


/Ole
It is really strange, on my ubuntu 12.04 laptop it works ok while on the company server when I log in not with ssh option -X but only with
ssh bellatrix.dev, I get this message explaining the cursor issue :)

michel@bellatrix:/tmp$ echo bla |./simple2.py
import: unable to open X server `' @ error/import.c/ImportImageCommand/362.
./simple2.py: line 6: syntax error near unexpected token `sys.stdout.write'
./simple2.py: line 6: `    sys.stdout.write(line)'
michel@bellatrix:/tmp$

michel@bellatrix:/tmp$ dpkg -S `which import`
imagemagick: /usr/bin/import

so it ran /usr/bin/import with argument 'sys' :D

And why bash is run instead of python? I suspect it has something to do with the custom kernel we use in our company so maybe some patch changes the behaviour of exec syscall :( So we can generally regard the git version as working and I will explore it more during weekend.

Michel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]