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

learn more… | top users | synonyms

1
vote
0answers
89 views

How do I fix my FastCGI Pinax / Django deployment?

I'm running OSX Lion (posted here because this is a Unix-specific question), and am trying to deploy a Pinax project via FCGI. I have the FastCGI daemon running: $ ps wwaux | grep fcgi jonathan ...
1
vote
0answers
152 views

How do I satisfy the “warnings” Pinax requirement?

I'm trying to build a Pinax virtualenv. I get, on Precise Penguin with 0.7: jonathan@ubuntu:~/Downloads/Pinax-0.7-bundle/scripts$ ./pinax-boot.py ~/virtual New python executable in ...
1
vote
2answers
1k views

Python script to shutdown system doesn't work in cron

A python script to shutdown system works fine from the terminal but doesn't work when included in crontab. The script is called by cron but ends with an error 'shutdown command not found'or 'init 0 ...
1
vote
3answers
5k views

How to change the working directory for a shell script

I have a Python script that looks files up in a relative directory. For example: the Python script is in /home/username/projectname/. I have a file that is being called within the Python script that ...
2
votes
1answer
160 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 ...
5
votes
2answers
2k views

On Debian, how do I add a Python package in dist-packages to a virtualenv?

Given some python package in /usr/share/pyshared/ or /usr/lib/pythonX.Y/dist-packages/ (take python-numpy or python-scipy for example), how do I add that package to a virtualenv? When adding the ...
1
vote
0answers
70 views

How to access storage device related events with Zeitgeist?

I am trying to get my mind around Zeitgeist, using the Python DBus API. To get the latest accessed files and application is not so hard, here is what I do: #! /usr/bin/env python from ...
4
votes
4answers
5k views

How can I upgrade pip on Ubuntu 10.04?

On Ubuntu 10.04 I've used apt-get install pip to install pip after which I installed django. Then I tried to uninstall django with pip via pip uninstall django which gives me: pip: error: No command ...
3
votes
1answer
222 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. ...
0
votes
1answer
3k views

How to manually uninstall urllib, urllib2, requests python packages?

I'm having a problem with urllib, urllib2 and requests, three python libraries. I use Ubuntu 10.04.4 LTS and python 2.6.5 (we can use with python) (but I had installed manually, after the problem, ...
3
votes
3answers
606 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
82 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
805 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
149 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 ...
2
votes
2answers
1k views

What does this python2 error mean, and what should I do about it?

Whenever I attempt to use an application relating to python2(gnome-tweak-tool, bzr, etc.) it fails to start and, when run from command-line, I get this error: [username@host ~]$ gnome-tweak-tool ...
4
votes
2answers
6k 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. ...
2
votes
1answer
206 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
509 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 ...
7
votes
3answers
508 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, ...
0
votes
1answer
240 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 ...
7
votes
3answers
2k views

Which window manager has Python bindings?

I've been coding bits here and there with Python and I'm most interested in Desktop Environments, for which I always have ideas I want to try out. I have tried to play around with python-xlib but ...
3
votes
4answers
415 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 ...
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 ...
1
vote
1answer
691 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 ...
4
votes
3answers
6k views

Running python script from terminal without .py extension

I want to call a python script script.py from the terminal by simply typing script. Is this possible? If so, how? I know I can avoid typing python script.py by adding #!/usr/bin/env python to the top ...
8
votes
1answer
809 views

python == python2 OR python == python3 ? How to package, distribute python py2k scripts?

Depending on system, python==python2 or python==python3. Executable Python scripts, starts with: #!/usr/bin/env python #!/usr/bin/env python2 #!/usr/bin/env python3... For python py3k it is ...
2
votes
2answers
2k views

How to execute this particular shell command from Python?

OK, so, I have this non-functional shell script, which I am rewriting piece by piece in python, except I am getting an "unexpected "|" error" from the shell (see below): #/bin/sh LINES=`cat $@ | wc ...
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 ...
2
votes
1answer
840 views

New files and folders created, automatically inherit same permissions as parent folder

Does it exist? I create a folder with, let's say, all permissions set, and some services (i.e. Apache web server) create subfolders and put files there (uploaded media files from website users). Such ...
1
vote
2answers
103 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?
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 ...
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 ...
12
votes
1answer
12k views

How can I start the python SimpleHTTPServer on port 80?

I am using this command on Ubuntu but it is starting on port 8080 and I don't have another server running so I'd like it to start on port 80. I saw ways that you could set up a bash script to do ...
0
votes
2answers
2k 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 ...
1
vote
4answers
718 views

chmod - change permissions on a file

I have a Python virtualenv, and the Python executable is located in the /bin directory. In this virtualenv I'll have to execute some unsafe code, that can damage my system. I tried to chmod a-r on the ...
0
votes
0answers
248 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 ...
2
votes
1answer
188 views

Will I break debian etch if I install python-support 0.7.1 to it?

I try to install s3cmd into my debian etch, but the following error message comes up: root@NAS-01G:~/src$ sudo apt-get install s3cmd Reading package lists... Done Building dependency tree... Done ...
1
vote
3answers
410 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
269 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 ...
11
votes
5answers
5k 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?
3
votes
1answer
741 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
3answers
338 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 ...
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 ...
6
votes
1answer
326 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 ...
3
votes
2answers
765 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: ...
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
370 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 ...
2
votes
3answers
666 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 ...
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 ...