[SOLVED]Recursively use makepkg with python...or bash!

I am basically trying to build a base Archlinux system from scratch on my eee pc. I researched Pacbuild a little bit but decided to try my own had at this.
After being completely unsuccessful at trying to write bash scripts with loops and variables and whatnot, I took a look at python. I basically just searched a bunch of python tutorials on google and came up with this. So..this being my first script and all I was wondering if this would be the right way to do this. It basically works except with no error checking and if I want it to stop i have to press ctrl-c until the loop ends...but other that it works fine.
#! /usr/bin/env python
#import bash commands
import os
import sys
#open pkglist file
pkglist = open('/home/rhune/list', 'r')
pkgname = pkglist.readline() #read pkgname in file
while len(pkgname) != 0:
pkgname = pkgname.rstrip('\n') #delete newline
os.chdir('/home/rhune/eeepkgs')
os.chdir(pkgname) #cd /home/rhune/pkgname
os.system('makepkg') #run makepkg in working dir
os.chdir('/home/rhune/eeepkgs') #cd ../
pkgname = pkglist.readline() #read pkgname in file
pkglist.close() #close file
The "list" file is a list of folders in the directory im pointing to.
I also plan on having it accept an argument of what folder to run in and using the tempfile to create the directory list, and with some sort of error checking. But thats a whole nother project.
Any comments or contributions appreciated!
edit: is there a way to check if makepkg successfully compiles the package? i.e. does it return a 1 or 0 or some sort of value? Or would i have to parse the actual output of it?
Last edited by rhune (2009-08-28 04:48:05)

Thanks much! This works, just gotta pick a better place to store the output.
#!/bin/bash
cd $1
for folder in $(find * -type d)
do
cd $folder
makepkg -s
if [ $? -gt 0 ]; then
echo $folder >> '/home/rhune/failed'
else
echo $folder >> '/home/rhune/passed'
fi
cd ../
done
Also figured out this in python:
!/usr/bin/env python
import os
import subprocess
base = "/home/rhune/test/pkgs"
failed=[]
dir = os.listdir(base)
dir.sort()
os.chdir(base)
print dir
for x in range(len(dir)):
os.chdir(dir[x])
retcode = subprocess.call(['makepkg', '-s'])
if retcode==1:
failed.append(dir[x])
os.chdir(base)
print failed
The bash one seems a bit simpler though.
Also, this:
#! /usr/bin/env python
import os
import sys
deplist=[]
depname=""
count=0 #count apostrophes
#search for depends= line in pkgbuild
with open('/home/rhune/pkgs/yaourt/PKGBUILD', 'r') as pkg:
for deps in pkg:
if "depends" in deps: break
deps=deps.strip('depends=')
#insert depnames into deplist
for x in deps:
if x=="'": count+=1 #counts apostrophes
if x.isalpha(): depname+=x
if count==2:
deplist.append(depname)
depname="" #reset depname
count=0 #reset count
#pbget for each dependency in list
for x in range(len(deplist)):
os.system('pbget --arch=i686 '+deplist[x])
Reads a PKGBUILD file and pbgets dependencies. Need to change sys to subprocess, didnt realize it was outdated. Still needs a little work, but its practically done. Also made a sed script to go through each directory and change the PKGBUILD to use gcc-4.5 for the atom optimization.
#!/bin/bash
cd $1
ls -l
for folder in $(find * -type d)
do
cd $folder
sed -s 's/\.\/configure/CC=gcc-4.5 \.\/configure/' PKGBUILD > tmpfile ; mv tmpfile PKGBUILD
cd ../
done
These being the first time ever writing any sort of scripts, i think im getting the hang of it. Thanks to a little (and i mean little) bit of c++ knowledge.
So im basically ready to compile the whole system, hopefully itll all work!
Thanks
edit: also, maybe a stupid question, but why does $0 -gt 0 work? does the script return a 1 or 0 after each iteration or is it from makepkg?
Last edited by rhune (2009-08-28 04:53:52)

Similar Messages

  • I can't paste nor copy using IDLE with Python 2.7. Can somebody fix the problem

    I can't paste nor copy using IDLE with Python 2.7.
    Can somebody fix the problem

    I just launched IDLE for Python 2.7.2 on Mac OS X 10.8.4.
    The defaults for IDLE assume a PC environment and not Mac, thus it was expecting control+c, control+v for copy and paste. Under the IDLE Options menu, Configure IDLE...
    Under the Keys tab, Use a built-in key set, select IDLE Classic Mac. Now command+c, command+v work.
    Since I didn't want to squint, I set my Font to Ubuntu Mono 14 pt.
    I applied these settings and clicked ok.
    I successfully copied from a terminal window and pasted into IDLE with no issue.

  • Blee, plugin for Maxon Cinema 4D R12 using Kuler with python

    Hi,
    I just finished Blee, a free plugin for Maxon Cinema 4D R12 using Kuler with python.
    Blee will create for you a layer of materials, each one getting the  color from the Kuler theme: you will get 5 materials in a layer named  according to the theme title.
    check here the screenshot at http://www.mediafire.com/i/?u4qkl9ebt2bb6zk

    Sweet! I'm going to download and try it out.

  • [SOLVED] Cannot install KDE with python-numpy pre-installed?

    Hi, all
    I am with xfce currently and though of tring KDE. However when I  tried to install KDE it turns that there are confilicts between 'kde' and 'python-numpy':
    :: Proceed with installation? [Y/n]
    (318/318) checking keys in keyring [####################################] 100%
    (318/318) checking package integrity [####################################] 100%
    (318/318) loading package files [####################################] 100%
    (318/318) checking for file conflicts [####################################] 100%
    error: failed to commit transaction (conflicting files)
    python2-numpy: /usr/bin/f2py2 exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy-1.8.0-py2.7.egg-info exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/__config__.py exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/__config__.pyc exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/__init__.py exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/__init__.pyc exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/_import_tools.py exists in filesystem
    python2-numpy: /usr/lib/python2.7/site-packages/numpy/_import_tools.pyc exists in filesystem
    Can anyone help please?
    thanks,
    ps:
    python-numpy was installed via "pip install numpy" instead of "pacman -S python-numpy". Could this cause any problem?
    Last edited by hellolj (2014-03-02 06:15:30)

    circleface wrote:
    hellolj wrote:By that, does it mean I should always stick to using "pacman" instead of "pip install"?
    Generally it is less pain to stick to pacman only.  Using anything else would mean pacman cannot know what packages certain files belong to, similar to what you ran into here.
    Got it. Seems I have to reinstall my python packages from scratches again.
    Thanks to all the help.
    SOLVED.

  • Using launchctl with python script

    I have been trying to get launchctl to run a python script for me every 3 minutes. I have read many threads and such to no avail. Following describes files and such.
    PLIST file location = /Users/mike/Library/LaunchAgents
    File name = scraper.plist
    File owner:group = mike:staff
    File contents =
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/Prope
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>scraper</string>
    <key>OnDemand</key>
    <true/>
    <key>Program</key>
    <string>/Users/mike/scripts/python/backgroundscript/runscraper.sh</string>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/Users/mike/scripts/python/backgroundscript</string>
    <key>StartInterval</key>
    <integer>3</integer>
    </dict>
    </plist>
    SCRIPT INFO:
    Location = /Users/mike/scripts/python/backgroundscript/
    File name = runscraper.sh
    File Contents =
    #!/bin/sh
    say "hey mike"
    /usr/bin/python /Users/micahrye/scripts/python/backgroundscript/scraper.py
    File owner:group = mike:staff (fro scraper.py and runscraper.sh)
    File permissions = 755 (fro scraper.py and runscraper.sh)
    NOW about the script, I have the shell script runscraper.sh call the python script. All works from the cmd line, but does not work when launchctl calls it. I put the following in the runscraper script to make sure it was getting called:
    say "hey mike"
    So every time launchctl calls runscraper.sh I hear the "hey mike," so I know that launchctl is calling it, BUT it does not seem to call or launch the python!!!! AGAIN, if I run runscraper.sh from the cmd line I hear "hey mike" and the python script run with no problems.
    I have checked log files and found nothing.
    I have tried many things and nothing has worked, would enjoy someones wisdom
    thanks

    Post to the Unix forum under OS X Technologies.

  • How to install Berkeley DB to use with Python 3?

    I have heard that Berkeley DB is a good database.
    It seems it used to included in Python 2.x standard libraries but got excluded from 3.x version.
    I want to use only Python 3.x, so I need to install Berkeley DB somehow to use it with Python 3.x.
    Could you give me a step-by-step guide how to do it?
    Thank you.

    It should be but it is not.
    setup.py gives errors:
    C:\Users\3X\Desktop\bsddb3-5.3.0>python setup.py
    Traceback (most recent call last):
    File "setup.py", line 7, in <module>
    import setup3
    File "C:\Users\3X\Desktop\bsddb3-5.3.0\setup3.py", line 322, in <module>
    db_h_lines = open(os.path.join(incdir, 'db.h'), 'r').readlines()
    FileNotFoundError: [Errno 2] No such file or directory: 'db/include\\db.h'
    I am using Windows 7 x64, Python 3.3.2.
    Thank you
    Edited by: 1009721 on Jun 6, 2013 11:23 PM

  • Problem with python script [solved]

    I've been trying to run this script (with wlan0 as my interface) and it spits this out. I'm guessing this is due to some sort of syntax problem and should be pcap.somethingelse(interface) instead of pcap.pcap(interface) but I have no experience with python so I'm totally clueless.
    Traceback (most recent call last):
    File "mediaripper.py", line 143, in <module>
    pc = pcap.pcap(interface)
    AttributeError: 'module' object has no attribute 'pcap'
    Edit- NVM, I just had the wrong version of pypcap installed.
    Last edited by omgwtfbyobbq (2011-04-12 23:48:36)

    I hate to revive such an old thread, but what version of pypcap did you use? I'm having the same issue.

  • [SOLVED] Delete recursively all files with certain extensions

    Hi all,
    I am trying to recursively delete files with specific extensions. Many of these files have names containing spaces. The following, that I found googling around, didn't work:
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx' | rm
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx' -type f -ok rm '{}' ';'
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx' -exec rm -f '{}' \;
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx'| xargs /bin/rm -f
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx' -exec /bin/rm -f '{}' \;
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx'| xargs -0 rm
    and I think that it was the following that deleted all the files (except the directories):
    find /media/TSUNAMI -name '*out' -or -name '*aux' -or -name '*log' -or -name '*.blg' -or -name '*.toc' -or -name '*.bcf' -or -name '*.swp' -or -name '*blx' -type f -delete
    What am I doing wrong here?
    Thanks a lot in advance.
    PS. While writing this I realized that I fogot the dot in out, aux, log, and blx
    PS2. I'm experimenting around and don't mind deleting all the files if I do a mistake
    Last edited by geo909 (2014-09-30 06:12:04)

    geo909 wrote:Thanks so much. So  what is different when we group those options with \( \)?
    The implicit "and" operator binds stronger than the "or" (-o) operator. Therefore
    | -name a -o -name b -delete |
    will be grouped like this: 
    | (-name a) -o ( -name b -delete ) | .
    You want to group it like this: 
    | ((-name a ) -o ( -name b )) ( -delete )   | ,
    so you need to add some manual grouping: 
    | ( -name a -o -name b ) -delete |
    Last edited by progandy (2014-09-30 05:52:29)

  • How do I install a version of vim with Python support?

    I'm trying to install a version of vim with Python support, but for some reason I can't seem to find anything useful when I search.
    So far I've found posts that say arch doesn't have one built with Python support, and use this <broken link> AUR package. I've search AUR for "vim python" which turned up nothing. There *does* exist extra/gvim-python3, but when I install that, then vim (not gvim) still tells me "Error: Required vim compiled with +python"
    This search:
    https://duckduckgo.com/?t=lm&q=arch+lin … on+support
    Provides:
    https://bbs.archlinux.org/viewtopic.php … 1#p1070281 - Only a link to a bug report
    https://bbs.archlinux.org/viewtopic.php … 0#p1144210 - Post with the 404'd AUR link
    What I finally found was this Gist with directions on using the ABS:
    https://gist.github.com/MicahElliott/3048622
    Ultimately you'll have to change the particular tar.xz files you use in the pacman -U steps, but this should get you vim with Python enabled.

    I have downloaded vim by cloning The Vim Mercurial repository.
    hg clone https://vim.googlecode.com/hg/ ~/bin/vim_bin
    Then i have a this script to install it in my own ~/bin/ dir.
    #!/bin/bash
    cd /home/myuser/bin/vim_bin/src
    echo "---Configure----"
    ./configure --prefix=/usr --localstatedir=/var/lib/vim \
    --with-features=big --with-compiledby="Custom Vim insall" \
    --enable-gpm --enable-acl --with-x=no \
    --disable-gui --enable-multibyte --enable-cscope \
    --enable-netbeans --enable-perlinterp \
    --enable-rubyinterp --enable-luainterp \
    --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config \
    --enable-python3interp --with-python3-config-dir=/usr/lib/python3.4/config > my_log
    echo "=== Make ==="
    make >> my_log
    echo "==== Install ===="
    make install >> my_log
    Hope it helps some one

  • Need help with python script for Deluge

    I am using Deluge 1.3.2 with web server, and all works fine, I use this script in the Deluge settings to execute upon torrent completion:
    #!/bin/bash
    torrentid=$1
    torrentname=$2
    torrentpath=$3
    torrenttimedelta=`/usr/bin/python2 /home/bobby/scripts/deluge/torrentTimeDelta.py $1`
    subject="Started download new torrent!"
    message="$torrentname to $torrentpath"
    echo -e `date`"::Finished downloading torrent:$2 in: $3" with id:$torrentid >> ~/logs/scripts.log
    echo -e `sendEmail -t [email protected] -f [email protected] -u "deluge server notification: torrent $torrentname is complete!" -m "$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete :)" -xu [email protected] -xp password -v -o tls=yes -s email.com` >> ~/logs/scripts.log
    echo ---------------------------------------- >> ~/logs/scripts.log
    This is to email me when a torrent is done and works. What I wanted to add to this email was the time taken to complete the torrent. I have gotten help from Deluge forum in this thread: http://forum.deluge-torrent.org/viewtop … =9&t=36989  However I think it's something with Python within Arch that is the obstacle, and so that helpful person can't do much more IMO. The python script I'm using is:
    #!/usr/bin/python2
    from deluge.ui.client import client
    from twisted.internet import reactor
    d = client.connect()
    def on_connect_success(result):
    print "Connection was successful!"
    def on_get_torrent_value(value):
    for torrent in value:
    print "%s: %s" % (torrent, value[torrent]["name"])
    client.disconnect()
    reactor.stop()
    client.core.get_torrents_status({}, ["name"]).addCallback(on_get_torrent_value)
    d.addCallback(on_connect_success)
    def on_connect_fail(result):
    print "Connection failed!"
    print "result:", result
    d.addErrback(on_connect_fail)
    reactor.run()
    Now if I call this from shell directly, it works. However, including it with my email script at the top, Deluge itself freezes and no email is sent. I run ps aux | grep deluge and I can see that the script has run, but apparently died and all is just hanging. I kill the script process and Deluge resumes just fine, the email is sent. Kinda confused how to remedy this, appreciate any help Thanks
    P.S. When I get the email, the part that says ""$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete "" shows nothing where $torrenttimedelta should be, it just says "and took to complete"

    [edit]  Sorry, I don't use deluge and I messed up my test script. If the script is executable try `/home/bobby/scripts/deluge/torrentTimeDelta.py $1`
    Are there any other errors? or try running bash with debug output to see if it will tell you something else
    The problem you are having is bash doesn't recognize variables inside the tick marks.
    Hope that helps
    Last edited by rickeyski (2011-07-05 19:27:36)

  • Can I force Leopard to use a different python installation

    I should have posted here initially at the Unix board...
    Dumb question: Will Leopard use a different python install in bash than the python used by an ordinary GUI application? I want control over which python install the GUI application uses.
    Does anyone know how to force Leopard to use a macports installation of python instead of the default Apple installation? I know how to get the shell to use it, by putting an "export" line into the ~/.profile file, or adding a .bash_profile file to ~/
    and the bash shell will use my macports install of python. However when I use an application called blender
    www.blender.org
    which relies on python for some operations, it refuses to recognize some python modules installed in the macports version of python, which can be running simultaneously in bash. The python shell in Terminal says the module has been imported because there is no error message, but blender and the Console both say the module was not recognized by blender. Is it possible that the application blender has been compiled in such a way that it will only look for leopard's version of python? Is there a way to get leopard's python to take into account the mess of folders in macports python so that it can use the files therein? I've already tried putting the +/opt/local/bin, sbin, lib,+ and include folders into the path returned by env.
    Refers to the macports python 2.5.4 and the current leopard python 2.5.1

    I'm not using MacPorts, and don't know how MacPorts installs Python. Is it installed in the form of framework?
    /opt/local/Library/Frameforks/Python.framework/Python.framework/
    If this is the case, then I guess you can tell blender to use this framework (instead of the Leopard's default framework) by setting the evironment variable DYLDFRAMEWORKPATH to "/opt/local/Library/Frameworks". Of course there is a possibility that the framework installed by MacPorts is not compatible with the blender.
    But there is another problem; if you start blender by double-clicking on its icon, the environment variables set in your shell have no effect. You can set environment for GUI apps in ~/.MaOSX/environment.plist, but it will affect all the GUI apps so it is rather dangerous (if a framework in /opt/local/Library/Frameworks/ is broken, then many apps won't run correctly). So the first thing you may try is to start blender from the command line:
    $ export DYLDFRAMEWORKPATH=/opt/local/Library/Frameworks
    $ /Applications/blender.app/Contents/MacOS/blender
    Of course the "$" above is the prompt of your shell, and you need not type it. If you have installed blender.app in a different folder then modify the path accordingly.

  • Building package using makepkg does not resolve dependency for another

    I am trying to install yaourt from the AUR. Yaourt required that package-query be installed, and this package further required another, etc.
    In short, package-query required yajl, which I downloaded from the AUR. This package does not actually have a PKGBUILD, but rather un-tars into a file that you need to merge with /usr. After doing so I tried to make the package-query package but was still met with a dependency discrepancy. Luckily, yajl was available in the official repositories (same version). After using pacman to install it everything went fine and package-query built and installed fine.
    When I went to build yaourt, using makepkg, it failed and informed that I was missing a dependency, package-query.
    So, in short, is there a registry or something that keeps track of these installed packages? I imagine that when running makepkg there is a query against installed packages to see if you meet the dependency requirements. What can I do to build yaourt in this situation?
    Last edited by sherrellbc (2014-06-08 18:37:19)

    cower doesn't have any dependencies that are not in the official repositories.  It doesn't build packages automatically, but it will download the source tarballs and unpack them for you.  It can also handle dependencies with the official repos and the AUR. 
    So for example, if you were to do cower -dd yaourt it would tell you that gettext, diffutils, and pacman are in the official repos.  Then it would download the source tarball for package-query and resolve all of its dependencies.  And it would download the yauort source tarball and unpack that for you.  So it gives you an idea of what depends on what and in which order you should build and install.
    But you really just shouldn't use yaourt.  Many of the upgrade issues that arise on these forums stem from people using yaourt (particularly those who blindly run yaourt -Syua).  The pacaur I mentioned above is a bash script that wraps cower.  So it too should be able to be built and installed without having to resolve other AUR dependencies.
    Edit:
    But none of this is really answering the question though. When I make a package from the AUR, the dependency requirement when trying to install another package is never met. That is, if package A requires B and I then installed B (from the AUR), when I try to make A again it still informs me that B was never installed.
    If this is the case, then you really don't know how to properly use the AUR, and thus should be reading up on that rather than trying to work around it with an AUR helper.
    Last edited by WonderWoofy (2014-06-08 19:18:47)

  • Boost install with python

    I'm having a few difficulties compiling and installing boost 1.34.1 with python. As I understand it I can either compile and link with gcc or with sun studio12, both of which are installed with SXDE. Going down either road seems to lead me dead ends.
    Using gcc I get errors like:
    gcc.link.dll bin.v2/libs/test/build/gcc-3.4.3/debug/threading-multi/libboost_unit_test_framework-gcc34-mt-d-1_34_1.so.1.34.1
    /usr/ccs/bin/ld: illegal option -- start-group
    /usr/ccs/bin/ld: illegal option -- end-group
    usage: ld [-6:abc:d:e:f:h:il:mo:p:rstu:z:B:CD:F:GI:L:M:N:P:Q:R:S:VY:?] file(s)which leads me to believe that I need to use the gnu linker (gld) and not the sun. I have not had any luck changing boost's configuration to explicitly do this. Even trying to modify the user-config.jam to say:
    using gcc : <linker-type>gnu; as mentioned in: http://lists.boost.org/boost-users/2007/10/31284.php
    So then I resorted to trying to use Sun Studio 12, which works fine until I get the problem mentioned at http://blogs.sun.com/sga/entry/boost_and_sun_studio_12#comments which suggests that I need to apply patch-01 for Sun Studio 12. Unfortunately, I'm not sure where to find the patch.
    Anybody with ideas for solving both problems would be appreciated.
    Thanks,
    Karl
    I would like information on how to resolve both problems.

    I had the same problem. I was able to solve it by manually specifying the linker to use. The sun linker and the gnu linker have very different parameters, and Boost does not autodetect which linker you are using. Based on your output, /usr/ccs/bin/ld is the sun linker, not the gnu linker. Many solaris platforms that compile with gcc use the sun linker. Sun's gcc distribution does this by default. Also, if you built gcc yourself, it will use whatever linker it was built with, which is probably the sun linker unless you explicitly configured it to use the gnu linker.
    After you run the Boost configure script, edit user-config.jam.
    You should see something like:
    using gccYou need to change it to something like
    using gcc : : : <linker-type>sun ; Note that you need 3 semicolons and you need to set linker type to sun, not gnu.
    You should now be able to run make and have Boost link correctly.

  • Python as Bash Replacement: coreutils?

    Hello,
    I want to start replacing my Bash scripts with Python ones, partly due to Python's performance being much better. However, all the modules I found whose goal is to aid replacing shell-scripting with Python, interface with the GNU coreutils through `subprocess`. As we all know, forking the process to call external programs is why shell scripts are that much slower.
    I was wondering if there's a Python module/library that replaces the behaviours of the coreutils, so that I don't have to write them myself, e.g. a `tail` behaviour written in Python. Or any other modules/libs that would aid in shell-scripting with Python without `subprocess`.
    Last edited by NewWorld (2014-03-22 07:38:36)

    lykwydchykyn wrote:Well, "os" covers a lot of ground, but you probably knew that already.  I'm not sure how you'd expect python implementations of coreutils to be faster than the C versions that BASH is calling.
    I have done research which concludes that shell scripts are a lot slower than Python. See this graph from this blog post, and this graph from this blog post.
    This answer on SO gives an explanation for shell scripts being slower:
    shell scripts are inherently slow, especially when they use a lot of external commands like yours. Biggest reason for this is because spawning external process is rather slow, and you do it a lot of times.
    If you are really after high performance processing of your data, you should write Perl or Python script which would do what you need without ever spawning any external process: no dos2unix, no grep, no cut or anything like that.
    @progandy, thanks a lot for the link. This module is also available for Python 2.7, which is what I'll be writing in.
    tomk wrote:
    NewWorld wrote:It's alpha and it's buggy
    Maybe you could help make it beta and less buggy?
    As I mentioned in the original post, I don't want to be writing  these tools myself; I'm already prone to RSI pain and that's just not how I want to spend my free time just to be able to write shell-scripts easier from within Python.

  • [solved ]Gedit plugins not working (python module missing)

    What's the problem with python gedit plugins? None of them works, all I get is this:
    Could not find platform independent libraries <prefix>
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    ** (gedit:8017): WARNING **: Could not import pygtk
    Traceback (most recent call last):
    File "/opt/gnome/lib/gedit-2/plugins/terminal.py", line 23, in ?
    import gedit
    ImportError: No module named gedit
    ** (gedit:8017): WARNING **: Could not load python module terminal
    ** (gedit:8017): WARNING **: Error, impossible to activate plugin 'Embedded Terminal'
    I've added all imaginable paths to PYTHONHOME and PYTHONPATH and I have pygtk installed. I could not find that gedit module anywhere either. What should I do?
    edit: solved by installing newest gedit from testing (2.18.0)
    Last edited by mikoro (2007-03-27 17:24:34)

    Mar2zz wrote:
    I am using Gnome indeed. I have the following items under Edit:
    - Undo
    - Redo
    - Cut
    - Copy
    - Paste
    - Remove (or delete, translating from Dutch)
    - Select all
    - Insert date and time
    That's it...
    Ok, try my suggestion: click on the Gedit icon in the top bar. It  might be in there. That's where GNOME is starting to put all of the application-wide (as opposed to instance-specific) menu entries.
    Last edited by jakobcreutzfeldt (2013-07-05 15:45:59)

Maybe you are looking for