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

learn more… | top users | synonyms

1
vote
1answer
368 views

Debian, virtualenv, IPython notebook and matplotlib inline plots

I have been using IPython notebook on both OSX and Windows 7 for a while. Now I'm trying to create a minimal system for me to work on Debian 7 (Wheezy). I installed: LXDE Python2.7 python-dev ...
1
vote
2answers
417 views

How to get name of Display Manager on Linux? [duplicate]

I want to see Display Manager name (Gnome, KDE etc.) via python or bash script. Is there any command for it as uname? (I try fedora and Debian)
-1
votes
1answer
450 views

Convert SVG to PDF in python [closed]

I am trying to convert an SVG file to PDF in python using the svglib and reportlab packages. Here is the SVG file. <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG ...
2
votes
1answer
263 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 ...
3
votes
2answers
679 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 ...
4
votes
2answers
532 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 ...
0
votes
1answer
79 views

Gajim, gtalk, and logind

Since the Google talk outage earlier this month, I keep not being able to connect using gajim. I tried deleting all the configuration, updated to the latest development version, and tried in different ...
2
votes
1answer
68 views

process continous output of synclient

I am using synclient to track the position of finger on the touchpad. I use the following command. synclient -m 100 | awk '{print $2,$3}' This command gives the 'x' and 'y' co-ordinate on the ...
8
votes
4answers
2k views

Hybrid code in shell scripts. Sharing variables

This answer discusses how to run a multi-line Python snippet from the command line in a terminal. I noticed that the answer works great within shell scripts, even with nested indentation, which is ...
2
votes
1answer
514 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
1answer
120 views

Can't open Gajim

When I try to open Gajim using terminal on gnome I get the following: Traceback (most recent call last): File "gajim.py", line 106, in <module> import common.configpaths File ...
1
vote
1answer
3k views

Software Center not opening in Linux Mint

I'm a Linux Mint 14 user. I'm not able to open the software center. $ software-center ERROR:root:DebFileApplication import Traceback (most recent call last): File ...
1
vote
1answer
314 views

Safely convert unicode strings to printable characters

I have many HTML files containing mixed unicode strings like \303\243 and printable characters like %s. What I'd like to do is converting the unicode strings into printable characters in a safe way. ...
2
votes
2answers
42 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".
3
votes
3answers
2k views

Delete XML node containing certain element

I want to remove all Placemarks from a KML file that contain the element <tessellate>. The following block should be wholly removed: <Placemark> ...
2
votes
3answers
764 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 ...
1
vote
2answers
607 views

Backup to a synology NAS with bup

I am trying to make a remote backup to my Synology NAS (DSM 4.1) using bup. I compiled bup on my NAS from source, did there: BUP_DIR=/volume1/public/Backups/bup bup init Initialized empty Git ...
0
votes
1answer
74 views

Can a GTK applet widget be instantiated through dbus?

I just posted this: #274616: “Simple” gnome applets in Unity - stickynotes ... where I could instantiate a Gnome 2 bonobo applet in a standalone window, ... using ...
2
votes
1answer
96 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 ...
1
vote
0answers
301 views

avconv/ffmpeg output through /dev/ttyAMA0

I tried to pipe streaming video from video4linux2 webcam connected to a Raspberry Pi through /dev/ttyAMA0 to a computer using an Arduino as a intermediary. First of all, is it possible? Because I was ...
2
votes
3answers
685 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 ...
0
votes
2answers
427 views

How to make Python scripts usable on Windows? [closed]

I have some Python scripts in Linux. How can I make those scripts so that windows user can use and execute them?
1
vote
2answers
203 views

how to install ast python package

I'm using django constance in my project. This app used a python package ast. When I try to install that package using command pip-2.7 install ast, it results as "Could not find any downloads that ...
2
votes
2answers
2k 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 ...
0
votes
1answer
233 views

Can't use peewee on Mac OS X Mountain Lion

I am getting an error when I run Python programs that imports peewee: ImportError: No module named peewee The same program works fine under Ubuntu 12.04. I used pip to install peewee, and it ...
1
vote
1answer
469 views

Use tabs for indentation in Python mode

I am using Emacs for Python developement. My team is using Tab indentation, so I must do the same. The problem is that I can't figure out how to make python-mode use tabs instead of spaces. I want ...
0
votes
1answer
93 views

Installing a plugin for quodlibet as a patch

I'm trying to update a plugin for quodlibet. I fetched a .patch file from here. I navigate into the directory where the plugin is placed /usr/share/pyshared/quodlibet/plugins/events and copy in ...
7
votes
1answer
1k views

Problems running python script from motion

I'm trying to set up the raspberry pi with my webcam as a motion detecting cctv that uploads the videos to google drive using Jeremy Blythe's script I have motion working correctly and the python ...
0
votes
3answers
382 views

Is shebang always the same as the interpreter's installation directory?

Must the shebang header always match the interpreter's installation directory? If so, then why do both #!/usr/bin/python and #!/usr/local/bin/python work for me?
9
votes
5answers
1k views

How can I have more than one possibility in a script's shebang line?

I'm in a bit of an interesting situation where I have a Python script that can theoretically be run by a variety of users with a variety of environments (and PATHs) and on a variety of Linux systems. ...
1
vote
1answer
372 views

Managing the output streams of many subprocesses with deadlocks

I have a Python script that does more or less this current_tasks = TaskManager() MAXPROCS = 8 while len(outstanding_tasks) > 0: if len(current_tasks.running) < MAXPROCS: ...
1
vote
0answers
205 views

How to resume the ?WATCH command when a USB GPS is reconnected

I have some hacks to ensure that my USB GPS devices continues spitting data if disconnected, then reconnected. The devices are so flaky that they need restarting so as to continue transmitting data. ...
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 ...
0
votes
3answers
240 views

apt-get install packages for python2.7

Whenever I install a package for python it only installs for Python2.6 which came with the Debian 6. I am wondering how do I install for python2.7 with apt-get. Presently I am downloading the tarballs ...
2
votes
1answer
126 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 ...
1
vote
3answers
6k 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
2answers
14k 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 ...
5
votes
1answer
144 views

Correct handling of Python2 and Python3

What is the correct way running scripts that depend on python2.x but on a system where python3.x is aliased with python. The solution should take into account the following things : Python2 ...
2
votes
0answers
54 views

Losing sound after installing wine 1.5 (+python 2.7)?

I have a desktop and a laptop computer. Since I wanted to run IrfanView (that works great now!), I installed wine 1.5.22, which involved installing 1 GB of dependencies. The desktop continues to work ...
1
vote
2answers
497 views

How do I compile Python 3.2 on NetBSD? Error code 127

I'm getting strange errors when I try to compile Python 3.2 on NetBSD 5.1: python ./Objects/typeslots.py < ./Include/typeslots.h > ./Objects/typeslots.inc python: not found *** Error code 127 ...
4
votes
1answer
2k 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: ...
2
votes
1answer
872 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
0answers
268 views

Python bindings for libtorrent-rasterbar are not working on debian

I'm running Debian 6.0.6 I've downloaded latest version of libtorrent-rasterbar from here: http://code.google.com/p/libtorrent/downloads/detail?name=libtorrent-rasterbar-0.16.6.tar.gz&can=2 and ...
1
vote
1answer
60 views

What to include in an RPM created from python packages

I'm looking to create a rpm for this tarball and couldn't figure out which files needed to be included in the package after the install. I am used to compiling some code and including the binary ...
2
votes
1answer
600 views

Subprocess.call() and gunzip error

I'm trying to use Python's package subprocess to gunzip and gzip files. I'm using the following command: subprocess.call(['gunzip', a_path+myfile_gz], shell=True) Then I get the error message: ...
1
vote
3answers
307 views

I want to run commands like make, make install, python setup install without changing directories

I have written a script which will download software from the internet to the current user's home directory and then untar it. And then I have to make and make install it and in some software I have ...
1
vote
3answers
1k views

How to run a Python script in Makefile

I want to write a Makefile to find specific files and run a Python script on each file. The Python script accepts sys.stdin input. find $(W)/$(OVE) -name "*.xml" -print | \ while read x ; do \ cat ...
2
votes
1answer
205 views

When I am in VirtualEnv and do apt-get install, is there any difference?

If I have a virtualenv activated when I do something like sudo apt-get install python2.7-dev should I expect different results than if I did it outside the virtual env? Limited theory says no, ...
12
votes
2answers
6k views

Best way to upgrade vim/gvim to 7.3 in Ubuntu 10.04?

I have to use Ubuntu 10.04 at work, and cant upgrade it. I'm using Vim/gVim 7.2. I want to upgrade it to 7.3 (with Python and Ruby extension support). Which is the best way? Add an entry in ...
0
votes
1answer
270 views

Sublime Text 2 not detecting python library if installed in /opt

I am attempting to install Sublime Text 2 in /opt/sublime_text. Once all the files are in there, I believe the executable not detecting the python libraries and throwing the following error: I ...