Tag Info

Hot answers tagged

6

You could use a process group: set -m ( for part in input_*; do (python3 "$part" || kill 0) & done wait ) set -m (and optional POSIX shell feature, required Unix shell feature) runs jobs in their own process group. In bash, yash, zsh, mksh, that's jobs of the subshell where set -m is enabled so the outer (...) and all the processes ...


5

There are a few reasons: Ubuntu still has Python 2.x scripts You can run Python 2 and Python 3 next to each other without issue, just call the right binary. Python 2.7 will get bugfix and security support until 2020 (and will likely see community support extend even further than that either directly or through other runtimes like Pypy et alii) Switching ...


3

This looks more like a python job to me. A general rule of thumb is: if your task requires only a "flat" and content-blind processing, core utilities (preferably gnu) are the way to go. This goes for string replacement, deletion, line-based processing, simple sorting, counting, filtration and so on... these tools allow you to very quickly write a one-liner ...


3

This is an example. PLAY with this first to get exactly what you need. It cannot break much as is. #!/bin/bash # Example of killing off all children > killfile > outfile.err kill_em() { echo 'killing all children ' > 2 while read pid do kill -0 $pid && kill -9 $pid # if still running kill it done < killfile exit ...


2

Assuming you want to view the nth line of a file, you could simply do: sed -n '42p' yourfile.py Replace 42 with whatever line number you want to see. After your edit: If you also want to execute this code, simply pipe it to python: sed -n '42p' yourfile.py | python


2

sed -e :n -e '$!N;/\n.*\n/!{$!bn }; s/some text,\n* *something else\n* *another thing/this is completely\ different text/;P;D' <infile I fear you're going to have a difficult time coming up with a solution that suits you until you hammer out a concrete description of the problem - but that's what QA is best suited for, as I see it. Maybe this will give ...


2

As you seem to have trouble compiling from source, why not install the package straight from the Ubuntu repositories? If you do a search on http://packages.ubuntu.com/ for wxPython over all versions, you get this result and under the Package python-wxversion title on that page you will find: lucid-updates (python): wxWidgets Cross-platform C++ GUI toolkit ...


2

When you start butterfly from shell, it removes quotes around 0.0.0.0. On the other hand, systemd doesn't do quote expansion in this situation, because it is not a shell. Actually, systemd is capable of stripping quotes around arguments, but not in middle of them. So, try to remove quotes around 0.0.0.0 in your service file and see what changes. Do not ...


2

Typically, python package source files are located in /usr/lib/python<version>/site-packages. There's more information about this in the python docs: https://docs.python.org/2/tutorial/modules.html#the-module-search-path https://docs.python.org/2/install/#how-installation-works


2

You should go with whatever makes you most comfortable. That said, you shouldn't avoid learning the use of a new tool either. I am pretty comfortable with sed, and it is my belief that nl is uniquely suited to this task, and so using a combination of those two tools I did: <<\INFILE \ nl -bp'^//' -w1 -s' ' |\ sed -ne ' s|^ ...


1

I can't agree that python is more acceptable in the case. There is no difficult line manipulation - just set variables and print various set of it. So its are usual bash' operations. So we need some calculations I prefer awk instead of sed(usual text manipulation programm). awk -F '' ' /\/\//{ n++ t="Name "n" " ...


1

Alternate awk solution: awk "NR==2" programname.py


1

Here is a sketch of how to replace wxPython 2.8.12 with 2.8.10. This will probably work, but without actually trying it out, I can't be sure. You might find this question/answer useful as reference: How can I install more recent versions of software than what Debian provides?. What you are trying to do here isn't exactly a backport, but it is similar. ...


1

The respective FreeBSD bug is here. The fix adds symlinks: ln -sf /usr/local/etc/ssl/cert.pem /etc/ssl/cert.pem ln -sf /usr/local/etc/ssl/cert.pem /usr/local/openssl/cert.pem


1

For certain packages (ones that I most probably don't want to hack), I make my own package using this: https://github.com/bluepeppers/pip2arch then build and install the PKGBUILD produced. I leave virtualenvs for packages I might want to modify or hack.


1

We put multiple python distributions on Mac and Ubuntu a lot and here are my recommendation. Leave the system python unmolested: never use it. If you only need one primary python distribution, download and install Canopy from enthought. When it installs, choose "set as my system python", and then you can install packages from Canopy's GUI package manager. ...



Only top voted, non community-wiki answers of a minimum length are eligible