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

learn more… | top users | synonyms

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. ...
7
votes
3answers
477 views

Is it possible to execute scripts in BIND based on lookup

Is it possible, to set up BIND as DNS server on my local network, and make execute scripts when it gets a lookup? I would like to execute a Python or Bash script, based on the incoming DNS lookup, ...
3
votes
3answers
568 views

Why does installing python-minimal package also grab the python package on Debian?

From running: apt-cache depends python2.6-minimal | grep Depends and apt-cache depends python2.6 | grep Depends it looks like python2.6 depends on python2.6-minimal and a lot more. However, ...
0
votes
1answer
81 views

Install new most recent python package in ubuntu?

I could really do with installing matplotlib 1.1.0 on my ubunutu 11.10 system. The current ubuntu package is at 1.0.1, how do I use the new one?
0
votes
1answer
787 views

zlib support for PIL won't work

I'm trying to install PIL as per its instruction on debian but can't figure how to fix this bit: I get --- ZLIB (PNG/ZIP) support available on build_ext and * ZLIB (PNG/ZIP) support not installed on ...
0
votes
1answer
146 views

Python set up on mac

My /usr/bin contains the following installs of python lrwxr-xr-x 1 root wheel 76 Nov 18 06:17 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7 ...
1
vote
1answer
1k views

python-pam not working… How to dig for the error?

I have a django application where users should be able to login according to the system's shadow database. I found this login backend which uses python-pam, as far as I can tell. While installing the ...
4
votes
2answers
5k views

What is the python equivalent of grep -v?

I like grep -v. I use it all the time. But I am also doing some text processing in python, and there is one crucial thing that I lack. Usually, I use grep -v to take extraneous stuff out of text. ...
4
votes
1answer
1k views

How can I run tcpdump from a Python script without AppArmor complaining?

For inconvenient reasons going beyond the scope of this question, I have to run tcpdump from within a Python script. I currently just call subprocess.Popen(['tcpdump', ...) and everything works just ...
11
votes
5answers
4k views

How can I use environment variables in my shebang?

I have a Python script that need to be run with a particular python installation. Is there a way to craft a shebang so that it runs with $FOO/bar/MyCustomPython?
2
votes
1answer
204 views

Key-binding to open a terminal running python in ratpoison

In my .ratpoisonrc file I'm failing to write a key-binding to open a terminal running python. I'm running a minimal Debian setup on which I basically just run emacs. Sometimes I want to just get a ...
3
votes
0answers
500 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
0answers
1k views

MySQL socket and PHP (and other languages)

Background info I'm currently running CentOS (or Red Hat?). uname -a gives (I edited out my domain name) Linux XXXXXXXXX.com 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 ...
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
0
votes
1answer
229 views

python regex equivalent of kwrite [ ]+ and [0-9]+

I've never been good at regular expressions. When ever I read about them, I sort of get a headache, get up from my desk, and forget what I'm doing. Attention difficulties. But when I finally started ...
3
votes
4answers
399 views

Align a hex text file at 9 bytes each line

I want to align the selected portion of a text file at 9 bytes each column. For example suppose my text file looks like below. 00 2f c6 b8 29 fd 02 37 11 00 9f 74 34 0b 60 72 38 20 00 9e 61 33 8e ...
23
votes
3answers
7k views

How does /usr/bin/env know which program to use?

When I use the shebang #!/usr/bin/env python to run a script, how does the system know which python to use? if I look for a python bin path in the environment variables I find nothing. env | grep -i ...
1
vote
1answer
1k views

ImportError when running WSGI app in Apache: undefined symbol: PyUnicodeUCS2_DecodeUTF8

I'm trying to run MoinMoin under Apache on SLES 11P1. I'm getting the following error in my Apache log when somebody tries to access the site: mod_wsgi (pid=20772): Target WSGI script ...
1
vote
1answer
654 views

Install virtualenv on Fedora 16

I come from Ubuntu. I know how to install virtualenv and configure stuff on Ubuntu. Now Fedora seems pretty strange to me... Following these two guides: Setting up virtualenv, pip, virtualenvwrapper ...
1
vote
2answers
2k views

Python library conflict with lower version

I am trying to reinstall yum in CentOS. Because I made some mistake by removing python. so I got error as follows There was a problem importing one of the Python modules required to run yum. The ...
1
vote
1answer
162 views

How can I install hulahop

I cloned hulahop via git and I'd like to use it and try to run this example. I have a problem to find out how to build and install it. I also tried to install it with apt-get but I don't have this ...
4
votes
3answers
1k views

On which unix distributions is Python installed as part of the default install?

Does anyone know of an overview that would document on which (recent) UNIX distributions Python is available by default, i.e. part of the default installation? PS: Answers from StackOverflow, before ...
1
vote
2answers
101 views

Narrow characters

It would be awesome to modify spark to print narrow characters in for example Gnome Terminal. Is this at all possible with Bash / Python?
0
votes
2answers
1k views

Running Python script via cron with sudo?

Im using Linux Mint. I have written a python script that is designed to not be accessible to the logged in standard user but is still be executed while they are logged in. It is to run and log them ...
0
votes
2answers
1k views

Unix (Ubuntu Server): $PYTHONPATH resets to blank when I reboot [duplicate]

Possible Duplicate: How to make exported shell variables permanent? Each time I set the $PYTHONPATH on my new Ubuntu server machine (old Thinkpad) and reboot, it's reset to blank. I'm ...
0
votes
0answers
242 views

python error using an executable with Z shell

I'm getting this error from the Unix Z shell (I'm on Mac): python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: No such file or ...
3
votes
3answers
326 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 ...
1
vote
0answers
246 views

Why am I getting an AttributeError when I try to use Pyjamas desktop on Fedora 15?

I am trying to run pyjamas-desktop on my Fedora 15. All packages were installed, I have adjusted PYTHONPATH to include /usr/share/pyjamas/library, but when I try to run a simple example: from ...
1
vote
3answers
360 views

How to know which compiler is used to compile Python programs?

How can I know which compiler is used when I type python myapp.py in terminal?
1
vote
1answer
252 views

Can I execute a python statement from a terminal?

I'd like to simply execute a Python command without having to write a script or enter the interpreter. Is there a way that I could run something like: python --execute "pow(12.31351,2)" And have it ...
3
votes
1answer
721 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 ...
6
votes
1answer
313 views

How to stop python from looking for .py files

I have a system with very little resources (embedded). Because of that I only installed the python .pyo files (=byte compiled & optimized) for my program. Now when such a program runs, python ...
1
vote
3answers
2k views

7z command line add file to a flat directory 7z file

I would like to compress file "./data/x.txt" to path "./data/x.7z". When running 7z a ./data/x.txt.7z ./data/x.txt The file "./data/x.txt" holds data/x.txt as opposed to just (what I want) ...
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 ...
1
vote
1answer
360 views

Pipe Python Shell to source-highlight

When I try to make the Python shell get color: python 2>&1 | source-highlight --failsafe -f esc -s python the >>> prompt seems to be always delayed by 1 command. Why is this ...
1
vote
1answer
2k views

How to check if process already exists in python script? [duplicate]

Possible Duplicate: Check for process already running in webfaction? How can I check if a process is already being run using Python + Django on WebFaction hosting? For example, my process ...
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 ...
4
votes
2answers
2k views

Configure Python to include another directory when looking for packages

I'm on a SUSE machine where the default Python site-packages location is /usr/lib64/python2.6/site-packages. Some packages automatically install themselves in /usr/lib/python2.6/site-packages instead. ...
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 ...
1
vote
1answer
180 views

Python in GNOME code base

Is Python present in the Gnome code base? If so, how is it involved? Note: My question concerns the core GNOME Desktop Environment only (e.g. nautilus, gnome-session, NetworkManager) and any ...
5
votes
1answer
784 views

Measuring Python script bandwidth usage

I have a python script that uses urllibs to parse some web pages, and uses selenium to scrape pages with javascript, and I would like to know its cumulative bandwidth usage. I've looked at nethogs, ...
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
1answer
202 views

Virtualenv creation seems to do nothing

I have a problem setting up a Virtualenv on my web host server (to install python modules later on) So far I tried this (over SSH): wget ...
1
vote
1answer
336 views

How to build a python egg for a TRAC plugin?

I'd like to install a mercurial plugin for Trac. The manual provides an svn path with the source code. I need to create an "egg" from that source code. Do I need to have SVN installed in order to do ...
4
votes
1answer
602 views

How to get the name of the user that launched `sudo`

My problem: I have a Python program, and the user launch it using sudo. Sometimes I have to get the user's home, and I can do this only knowing its name: import pwd pwd.getpwnam(username) So: how ...
0
votes
3answers
209 views

*nix whose package manager DOES NOT split Python into multiple packages

Is there a *nix whose package manager doesn't split Python into multiple packages (typically something like python and python-devel). I'd really like to just get the entire standard library when I ...
5
votes
2answers
2k views

Arch Linux: python and python2 are in conflict

I've recently installed Arch Linux onto my primary (Ubuntu) computer, and it is working really well for me. It's fast, configurable, basically a faster version of Ubuntu. Since compiz-fusion isn't ...
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?
5
votes
4answers
6k views

Run Python script on startup

Running on Ubuntu Karmic. I need to execute the following (updated) script at boot time #!/bin/sh # /etc/init.d/scripts # Description: Starts Python scripts # ————————————————– # ### BEGIN INIT INFO ...
1
vote
2answers
760 views

using cron to run script

Hey guys, im trying to run a script using cron, im using a crontab created by the user ashtanga, in the crontab i have */5 * * * * /home/custom-django-projects/SiteMonitor/sender.py in top of the ...