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

learn more… | top users | synonyms

3
votes
2answers
269 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
1answer
1k views

Using Atlas from scipy

I installed Ubuntu 12.04 64 bit. I need to work with python and scipy, I installed them and when I run the test: python -c "import scipy; scipy.test()" I get the message: ImportError: ...
3
votes
2answers
110 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
2answers
355 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
1answer
667 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
168 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
3answers
355 views

Python 2.7 and 2.6 coexist on the same machine

I want to follow a guide to install some software on a ReadyNas Duo (sparc). The guide indicates I need python 2.7, but I already have 2.6 installed. ~# which python /usr/bin/python ~# ls -al ...
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
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
1answer
89 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
838 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
219 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
5k 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
623 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
177 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
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
0answers
16 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
2answers
911 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
48 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
144 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
475 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
983 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
256 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
3answers
70 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
233 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
1answer
1k 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 ...
2
votes
3answers
621 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
151 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
149 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
30 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
255 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
2answers
8k 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
2answers
31 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 = ...
2
votes
1answer
2k 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
3answers
292 views

How can I schedule a python program to run from another python program?

I'm running a Python program on my Linux server, and depending on some external data it has to run again at xx minutes or hours from now. So let's say it runs at 6 AM, and then it has to run again at ...
2
votes
1answer
400 views

Replace python built with UCS4 with UCS2

I've got fedora fc15 installed with python 2.7.1-7.fc15. It is built with ucs4 and I've got some packages here at work that are built with ucs2. I now cannot build other packages that use these ucs2 ...
2
votes
1answer
2k views

parsing process ID/names from /proc, thread IDs

When I'm parsing process IDs from /proc, obviously each thread of a process gets its own ID. And I realize that all the threads in that same process can be gathered from /proc/${pid}/task/. But my ...
2
votes
3answers
709 views

Unmet dependencies

I am trying to compile vim and install with "--enable-pythoninterp" flag, which needs the python-dev package. INFO I obtained the vim source from ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 Vim7.3 ...
2
votes
1answer
50 views

Piping periodic data between Python scripts

How to receive data from the environment e.g. bash I am trying to launch two Python scripts in bash and pipe stdout from one of them to stdin of the other. The first script outputs a single ...
2
votes
1answer
89 views

upgrade Python to 2.7.2

I have an embedded system running on Python 2.6.5 and i want it to upgrade to 2.7.2 (I have a running system with different kernel that runs 2.7.2). I have copied the binary but then it told me: ...
2
votes
1answer
156 views

Unable to install SciPy

I need to use the module skimage, which calls the module SciPy (I need to find contours) import numpy from sys import argv from PIL import Image from skimage import measure # Inicialization ...
2
votes
4answers
299 views

Keep running program requiring X server after logging off of ssh session

I have a python script that periodically generates a png image, and puts it on a server that I can access through a browser. The image displays the progress of a job I am running on the server. I'm ...
2
votes
2answers
3k views

Run a sudo (or startup) python script from cron on a Raspberry Pi?

I'm helping out with an art project (http://stargateeggbeater.com/ for those interested) built on Raspberry Pi. The RPi controls an addressable LED strip through the GPIO, using the spidev device per ...
2
votes
1answer
425 views

Pip install - CPU you selected does not support x86-64 instruction set

I'm trying to use pip install mysql-python inside a virtualenv container and am getting the error building '_mysql' extension gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall ...
2
votes
1answer
113 views

Change the default shell to Python

If I changed my default shell from BASH to Python3 or IPython, would my Linux system have issues or produce errors?
2
votes
1answer
112 views

Where are Python dist-packages stored in FreeBSD?

I am trying to find this path on FreeBSD but it is not working: /usr/local/lib/python2.7/dist-packages This same path is working on Ubuntu. Can please some tell me where I can find Python ...
2
votes
2answers
39 views

Start Repl/CLI in Background and Feed Commands

Lets say the python repl takes a long time to start up, is there a way to start it up in the background so I can create an alias and feed it commands like python-current "command to run".
2
votes
1answer
73 views

Vim :fold of python code not different to C/C++ code

When I enter the command :fold inside my python code in .py files, Vim inserts the /*{{{*/ and /*}}}*/ tags. They, of course, cannot be parsed by python interpreter. When I'm in python I would like ...
2
votes
1answer
104 views

What is the source of truth for currently active tty/pts connections?

I'm looking for a simple way to determine the number of currently logged in users, using only the filesystem and basic bash functions (instead of using binaries). The uptime binary appears to be ...