Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

learn more… | top users | synonyms

3
votes
1answer
2k views

Upgrade matplotlib to 1.2 or 1.3

I am trying to upgrade my python matplotlib but for some reason I can't get it to upgrade. I originally installed matplotlib with: apt-get install python-matplotlib which was fine. However it ...
3
votes
5answers
157 views

Listing directories based on size from largest to smallest on single line

I can use the following command to get a list of directories and their sizes and sort them from largest to smallest (in the example I renamed the directories to numbers to make this easier to ...
3
votes
4answers
2k views

Running python script from Linux Terminal

I have downloaded this script named, pyAES.py and put it in a folder name codes, inside a Desktop directory of my Linux, According to this example, ...
3
votes
3answers
260 views

Is there an equivalent of calling the built-in python function help('topics') but in bash?

I would like to explore man pages in bash using something similar to the python help('topics') function. Does this exist in bash? I know the bash equivalent of python's help('modules') would look ...
3
votes
2answers
303 views

Print row contain maximum and minimum value

I need to read the file (contains 16K rows)and print the entire row if any of columns and all columns contains max value (100) and all columns contain min value (0).The ouput example is given ...
3
votes
3answers
322 views

Why can't I call this program using its full path?

I am trying to build a command line wrapper in Python 3 for an exiting command line tool called spooky and I am having a hard time understanding some strange behavior. If I type spooky on the command ...
3
votes
2answers
156 views

Rescue value from second last line

After I run a script, I've got the following lines: PyMOL(TM) Molecular Graphics System, Version 1.4.1. Copyright (c) Schrodinger, LLC. All Rights Reserved. Created by Warren L. DeLano, ...
3
votes
2answers
495 views

Clearing/modifying previous libnotify notifications?

I have written a script which generates notifications like this: notify-send -i audio-card "Transferring audio playback to speakers." \ "Audio playback has been transferred to the analog output ...
3
votes
2answers
374 views

Wait for a X window to appear/disappear (in a sane way)

Inside a shell script, I need to wait for a window that has a string on its title to appear, do some action, and then wait for it to disappear, and do some other action. Until yesterday, I had this ...
3
votes
2answers
183 views

case sensitive substitution; same target ids

I am struggled myself to make a case sensitive replacement in a text file. Please find below a segment of my sed file that I am running as sed -f file.sed < input.txt > output.txt ...
3
votes
1answer
717 views

How to use cron + python to regularly adjust screen brightness?

I want to use cron and this script (http://askubuntu.com/questions/23593/use-webcam-to-sense-lighting-condition-and-adjust-screen-brightness): import opencv import opencv.highgui import time import ...
3
votes
1answer
45 views

Grepping a variable

I've written a simple init script to start and stop a Python script as a service. I have to be explicit about the version of Python I'm running, because this is on a CentOS 5 box with Python 2.4 & ...
3
votes
1answer
190 views

apt python error prevents me from resolving dependency problems for apt-get install

On Debian 6 servers dependency issues are preventing me from installing nis (or any package). When I try to resolve that issue I get a python error. How do I get past this issue and re-gain the ...
3
votes
1answer
255 views

Reading amount of tracks from an audio CD?

I'm writing a little script to analyze audio CDs. I'm specifically looking for a way to grab the track count from the CD, either from a shell-script or from Python. Is there an easy way to do this? ...
3
votes
1answer
1k views

How to display the name of the current Virtualenv?

I'm using virtualenv, virtualenvwrapper, zsh, oh-my-zsh, terminator, on Crunchbang. I'm trying to display the name of the current virtualenv like so workon example (example)... I've tried many ...
3
votes
2answers
3k views

How to install Python 3.x on Debian?

Being new to Linux, I chose Debian for my Linode because it seemed stable and secure. Now I want to write some sysadmin-type scripts in Python to teach myself the language. Based on this SO question ...
3
votes
2answers
32 views

Tilling window manager written in Python

Is there any tiling manager like XMonad but written with Python? I think Haskell was too hard for me. But I know python a little.
3
votes
1answer
135 views

How do I make Kate indent with spaces on Python files but use tabs for text files and other files?

My goal is to set Kate up to work properly on Python files but to use different settings (tabs not spaces) on other documents. I'm sure others are doing this, but I can't figure out a convenient ...
3
votes
1answer
897 views

Can I upgrade to a new version of Python on an old version of Ubuntu?

I have Ubuntu 8.04.3 LTS and ran this: $ sudo apt-get install python2.7 I got this: Reading package lists... Done Building dependency tree Reading state information... Done E: Couldn't find ...
3
votes
1answer
221 views

Suddenly I have troubles plotting with python

I have a code that I used yesterday to generate plots. Today, when I tried to use it (with the same input as yesterday), I get an error: QGtkStyle was unable to detect the current GTK+ theme. ...
3
votes
6answers
6k views

Python 2.7 on CentOS 5

Are there any half-official repositories for CentOS 5 with Python 2.7? EPEL provides only Python 2.6
3
votes
1answer
87 views

fail2ban permission denied on script

I've just upgraded from RHEL 5 to 6.5 and setup fail2ban anew. I can't seem to get my custom action to work now, supposedly because of a permission issue. I wan't to know what am I doing wrong, and ...
3
votes
1answer
1k views

Python not recognizing LD_LIBRARY_PATH?

I am trying to install Python2.7 on cr-48 chromebook in developer mode, and face a weird issue that I am having hard time searching for a solution on google. First some background.. the root partition ...
3
votes
1answer
262 views

python3 traceback error

Whenever I mistype any command in terminal instead of getting Error:Command not found I get this python message error Traceback (most recent call last): File "/usr/lib/python3.3/site.py", line ...
3
votes
1answer
1k views

Python.h: No such file or directory

I'm tring to build omniORB 4.1.6 under Arch Linux, however when I type make, here is the message: ../../../../../src/tool/omniidl/cxx/idlpython.cc:188:26: fatal error: python3.3/Python.h: No such ...
3
votes
1answer
586 views

py3compile error - Unable to get the locale encoding

After reinstalled the python3.2, I got the error as below when call py3compile: Fatal Python error: Py_Initialize: Unable to get the locale encoding LookupError: no codec search functions registered: ...
3
votes
1answer
3k views

How to do a binary install of Python 2.7 on SUSE Linux Enterprise Server 11?

My SLES11 box came with Python 2.6 installed. I would like to upgrade to 2.7. What is the easiest way to do this?
3
votes
2answers
2k views

Installing python modules for python2.6

On my CentOS 5.8 system (el5 , 64bit), I had python2.4 after OS install and I installed python2.6 now. Now I want to install python modules using yum. But whenever I install a new python module it ...
3
votes
1answer
49 views

How to determine the current Enhanced Zoom factor in Compiz?

When I use Skype :( need to, rather than want to ), I find that I sometimes want to open the main menu, but it doesn't have a shortcut key assigned to it (well, not one that I can find). I have ...
3
votes
0answers
155 views

Enable sqlite FTS Enhanced Query Syntax in python in RHEL6?

SQLite's full text search engine offers a simple query syntax (with AND and OR operators and -term for negation), as well as an enhanced query syntax which also allows parenthesis and NEAR — as well ...
3
votes
0answers
496 views

“Operation not supported” for setfacl inside a python script [closed]

I've programmed a script using python which logs in as root on the host machine and executes some commands. Therefore it uses ssh. I want to setup acl. If I do following commands in the command line, ...
2
votes
4answers
1k views

How can I run a process in a terminal window and then hide that window?

I want to run python ~/program/proxy.py in a terminal when I boot up. And then hide this terminal window (because it is just a proxy program, and I don't want to see the debug info). So how can I get ...
2
votes
2answers
681 views

How to test UPSTART feature of ubuntu to see my script gets restarted automatically if it gets killed?

I am running my Python script using upstart feature of Ubuntu so that if for whatever reason my Python script dies or gets killed, it can be restarted automatically. So I decided to use UPSTART ...
2
votes
1answer
106 views

Convert xml subtitle file to srt format

I have a xml subtitle that looks like this: <?xml version="1.0" encoding="utf-8" ?><transcript> <Item from="1.16" duration="4.68"><![CDATA[(Dong-hyuk is coming to see you now.) ...
2
votes
3answers
119 views

What should someone know about using Python scripts in the shell?

I'm wondering what should someone generally know about Python(the interpreter) when using it in the shell in Linux? This is what I have on Gentoo: # ls -al /usr/bin/python*; file /usr/bin/python; ...
2
votes
2answers
280 views

Python-friendly machine configuration management systems

Are there machine configuration management systems akin to: Puppet Chef which are natively, or at least intimately, Python-friendly? Any recommendations with supporting evidence and/or backing ...
2
votes
3answers
646 views

How to install StackApplet on Debian?

I would love to install StackApplet on Debian 6.0.2! I downloaded 'stackapplet_1.4.0_all.deb' and ran following command: root@debian:/home/dagrevis/Downloads# dpkg -i stackapplet_1.4.0_all.deb ...
2
votes
2answers
109 views

How does a parallelized Python program look with top command?

I work on a shared cluster. I've seen people run parallelized c code on this cluster which, when I use top to see what processes are running, are shown to be using (for example) 400% of the CPU, ...
2
votes
2answers
174 views

Aliasing 'python' to 'ipython' only when 'python' is run without args

I thought it would be nice to have an alias (in ~/.zshrc) to have 'python' aliased to 'ipython' ONLY when 'python' is run without args (otherwise, programs won't launch). First of all, how to express ...
2
votes
1answer
157 views

emacs python2.7

I would like to have emacs work as a python ide for me. I can't seem to find how to compile from within emacs. I'm using python2.7 but when I do M-x python-mode it seems to compile using python2.7. Is ...
2
votes
1answer
45 views

Count and merge consecutive patterns

I'm searching for a short snippet to find, count and merge consecutive duplicates using standard tools or a common scripting language. Say our input is: 1 2 2 2 7 22 a b b c c c c c d dd 2 2 c c ...
2
votes
2answers
387 views

Debian 7.1: duplicity error when using gdocs backend

I've installed duplicity backup tool plus python-gdata library on my debian 7.1 amd64 system. When I want to use duplicity to store my documents on Google Drive, it shows this error after asking for ...
2
votes
1answer
4k views

Running Python on ChromeOS

Is it possible to run the Python interpreter on a ChromeOS machine? I've found various editors you can use, but I would like the ability to run python applications as well. I would like to purchase ...
2
votes
1answer
398 views

Running 'make test' on an individual module for Python 2.7.4 build

I am working on building Python 2.7.4 on CentOS 6.4. When running the make test step, the test_gdb step fails, and I would like to get some more info as to why. Build commands I'm running: ...
2
votes
2answers
10k views

How to properly install Python packages?

I run a Slackware system and I'm trying to run some Python code, but getting a lot of errors such as this one below: >>> import urllib2 Traceback (most recent call last): File ...
2
votes
2answers
1k views

Arithmetic operations in regex

I am using gedit regex plugin (Python style regex). I would like to do some arithmetic operation on a backreference to a group. For example: PART 1 DATA MODELS Chapter 2 Entity-Relationship Model ...
2
votes
3answers
70 views

Unable to access CentOS setup Network Configuration after attempting Python update

I attempted to update Python on my CentOS 5.6 VM and have encountered some issues afterward. Initially, yum wouldn't work, but I have resolved that. However, now I am unable to access the Network ...
2
votes
2answers
41 views

How do I remove the new environment commands that were created by the virtualenvwrapper script?

I've installed and run virtuarenvwrapper.sh to try to configure an alternate version of python on my system. This script has placed somewhere a series of commands that are now executed whenever I ...
2
votes
3answers
70 views

Linux - preventing an application from failing due to lack of disk space

Due to an unpredicted scenario I am currently in need of finding a solution to the fact that an application (which I do not wish to kill) is slowly hogging the entire disk space. To give more context ...
2
votes
2answers
78 views

why cpulimit makes process STOPPED?

I'm running a python script which uses networkx package to run some algorithms on graphs. the script is import networkx as nx from networkx.algorithms.approximation import clique G = ...