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

learn more… | top users | synonyms

3
votes
3answers
15k views

On Red Hat Enterprise Linux 6.2 how can I use Python 2.7 as default not Python 2.6? I did but still showing 2.6?

RHEL 6.2 I have python 2.6 but I need default python 2.7 using yum packaging (so that nothing goes messed up, cause its a heavy duty working system, all I need the python 2.7 on it, without messing ...
0
votes
1answer
81 views

How do I clean up vi and reinstall it completely? [closed]

Basically when I try to run vi, I have the following error (and after open it, there are a lot of errors): Error detected while processing function UltiSnips#bootstrap#Bootstrap: line 35: Traceback ...
3
votes
1answer
2k 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.) ...
0
votes
1answer
577 views

How to fix “cannot find -lxml2” error while installing 'igraph' for python?

On Ubuntu 15.04 I am trying to install 'igraph' using the following command: pip install python-igraph in order to, well, use the igraph package in python to work with graphs and stuff. However, ...
2
votes
1answer
1k views

PIL install error: SyntaxError: Missing parentheses in call to 'print'

I am trying to install PIL (the Python Imaging Library) using the command: pip install PIL --allow-unverified PIL --allow-all-external seeing the following errors: gkhan@Gkan ~ $ pip install PIL ...
1
vote
1answer
312 views

Run a Python script in the background on boot

I recently installed the Google App Engine Development server on my FreeBSD home server to be able to test my GAE app remotely. What I can't figure out is how to run the Python development server as a ...
0
votes
1answer
87 views

How to import self made modules in Python on Ubuntu 15.04

I just moved from windows 8 to Ubuntu 15.04. I do some programming in python3, and some programs rely on imports from self made modules. In windows all I had to do was add the directory which contains ...
1
vote
0answers
28 views

The first click on Linux Mint menu does not open it

I noticed that the first click on the menu after rebooting or turning my computer on does not open it, I must click again to actually show it. I use LMDE with MATE. I have followed the instructions I ...
2
votes
0answers
79 views

Why is denyhosts not banning *some* brute force root SSH login attempts?

I recently noticed in my logwatch emails from a couple of servers that although denyhosts was doing its job for some brute force root ssh login attempts others seem to be ignored and continue to ...
1
vote
1answer
726 views

LD_LIBRARY_PATH ignored by Python 2.7

I'm trying to install Theano on a box for which I have no root access and it looks like that LD_LIBRARY_PATH is ignored by my installation of Python 2.7. Since I can't install packages at the system ...
1
vote
1answer
24 views

How is python invocation different when launched by Nagios nrpe?

When invoked with python2 after importing os and sys, the following function runs successfully but acts incorrectly when invoked by Nagios nrpe: def get_proc1_open_files(): # Set proc1_children ...
9
votes
3answers
2k views

How to list all object paths under a dbus service?

This is a follow-up question to A list of available DBus services. The following python code will list all available DBus services. import dbus for service in dbus.SystemBus().list_names(): ...
0
votes
1answer
95 views

Why are the bytes I'm receiving not the bytes I sent?

I've been working my way through a security games site, trying to automate what I'm doing using pwntools. I've come across a problem somewhere in my process, however. When I try to run the vulnerable ...
1
vote
0answers
130 views

How do I use the Python module “keyboardleds” to determine Caps Lock state?

I want my system to ascertain the state of Caps Lock (is it on or off) by inspecting the keyboard DIRECTLY. After much searching, I understand that this can be done in Python by using the module ...
1
vote
1answer
3k views

Install wicd on Slackware 14.1

I am trying to install wicd-1.7.2.4 on Slackware 14.1. I couldn't find configure or makefile in wicd-1.7.2.4.tar.gz. Running python setup.py configure (following the INSTALL guide) causes: sh: ...
0
votes
0answers
126 views

permission needed for Python to access USB drive?

I got this Python script that reads media files from USB stick. It used to run fine, today it keeps giving me OS Error: [Errno 13] Permission denied: media/myName/usbName when the script runs the ...
1
vote
1answer
73 views

How do I get the pid of the exact progarm launched

So I have a couple python programs say program A and program B, when using "pgrep python" to get the pid, it gives me the pid of both program A and program B. However, I am writing a program that need ...
0
votes
1answer
80 views

python gnupg cannot user keychain keys

I have an issue using the gnupg module in python in Ubuntu 14. My keychain is set up correctly. I can use gpg on the command line to decrypt files with having to enter my passphrase. I have also ...
2
votes
0answers
44 views

How can X11 shortkeys be captured by a Python program?

I want to have a little Python program running in the background that monitors for certain shortkey presses (e.g. Ctrl Alt direction key). The idea is that these shortkeys can trigger various actions. ...
2
votes
1answer
572 views

How to suppress input overrun messages

I have a Raspberry Pi running Raspbian (a Debian flavor: Linux version 3.12-1-rpi (debian-kernel@lists.debian.org) (gcc version 4.7.2 (Debian 4.7.2-5+rpi1) ) #1 Debian 3.12.9-1+rpi1 (2014-05-19) ). ...
0
votes
2answers
439 views

root access on new chromeos lenovo n21 for python dev

We've purchased several new Lenovo N21 chrombooks to run Python workshops for inmates in the local jail. Trying to install Crouton, Debian, and Anaconda to prepare. All require developer mode and ...
14
votes
5answers
19k views

Install PIL/Pillow via pip in Debian testing (Jessie)

On Debian testing (Jessie), when I try to install PIL or Pillow (python imaging libs) in a virtualenv via pip I get the following error: running egg_info writing Pillow.egg-info/PKG-INFO writing ...
0
votes
0answers
140 views

Compiling 64bit Python on HP-UX (Itanium)

I'm trying to compile 64bit Python (2.7.10) on HP-UX (ia64), as per the Python readme, but can't seem to get it to work properly. This is what I'm using. I've also removed the "-O" from the OPT line ...
0
votes
0answers
13 views

How to avoid the python script file output in the terminal? [duplicate]

I'm in my Macintosh Terminal. I was running a python proxy script at local and everything works fine except the python script keeps throwing out all kinds of logs in my terminal. How do I avoid them? ...
1
vote
1answer
152 views

Python script works from terminal, but fails in scheduler, to write to external drive

I am trying to use a Python script to read/write from an external disk in linux, which works fine. The problem comes when I use a job scheduler to execute the Python program. I am running all this on ...
3
votes
0answers
304 views

ViM and Python says the encoding is ANSI_X3.4-1968

In ViM, the following command (using Python 3.4.3) outputs ANSI_X3.4-1968: :!python -c "import sys; print(sys.stdout.encoding)" However, I want UTF-8 everywhere. In .vimrc, I do have set ...
2
votes
2answers
150 views

Why is mail-utils / cron sending out so many emails?

I was trying to troubleshoot why my Raspberry Pi isn't sending emails with ssmtp / mail-utils, and so I opened up my gmail account that I use for the Pi. To my surprise, there were 15k unread emails ...
1
vote
1answer
49 views

Tell Python to use alternative library

I am trying to use an alternative version of opencv (3.0) in my Python scripts. I compiled and installed this version to my home directory, and now I am trying to tell Python to use it. I have the ...
0
votes
1answer
118 views

Need script to kill python process with low CPU usage

I've created a very large and complex python program and I now know it has a serious bug that I'm having a very hard time pinning down. I'm using this code in a production environment so I need a ...
0
votes
0answers
42 views

How to steal keystrokes instead of just monitoring them?

I am writing a program that allows controlling the mouse through keyboard. The user is supposed to assign a hotkey to start the program, which runs in the background without GUI or CLI. The keyboard ...
19
votes
5answers
16k views

Using different versions of Python

Background: Since I develop python programs that must run on different python versions, I have installed different versions of python on my computer. I am using FC 13 so it came with python 2.6 ...
6
votes
2answers
79 views

direct execution of python scripts

I have noticed that sometimes python scripts are not being started directly, ie /foo/bar.py, but rather from a shell script, which does nothing else than /usr/bin/python -O /foo/bar.py $@ One such ...
1
vote
1answer
304 views

python3.4 failed to import gi

I have tried many ways to install gi on my Mint17.02. zen@zen:~ > sudo pip3 install gi zen@zen:~ > sudo python3.4 -m pip install gi Requirement already satisfied (use --upgrade to upgrade): gi ...
2
votes
1answer
61 views

python Vs bash string slicing

My file a contains the text, bcd\\\\. With bash, i read the file and print characters from 4th to 8th position as, tmp=$(cat a) echo "${tmp:3:4}" It prints, \\\\ All happy. Now i use ...
3
votes
1answer
1k views

Python script run while screen is locked

I have a python script which seems to be failing to continue running its while True: ... sleep() loop my code is at http://github.com/xdaimon/xdaimonConky What happens is I autostart python on ...
4
votes
1answer
572 views

Display cron job times in a human-friendly format

Is there a way to display or is there a tool that can parse a crontab expression and display it in a human-friendly way? 10 6 * * * sh /usr/local/crons/file_check.sh For example, for the above cron ...
1
vote
1answer
2k views

How to install the pylzma python library on Linux?

The pylzma library is a requirement for another tool that I would like to use. I am new to python and programming and have a few questions: I have already followed the procedure to download and ...
0
votes
0answers
516 views

Cannot install pyzmq

I'm trying to install pyzmq on my Elementary OS netbook as it is a dependency for ipython notebook. The full report is at github as exceeds the stackexchange character limit. Here are the last few ...
0
votes
0answers
205 views

How to sync Google Calendar gcalcli with Conky/Desktop?

Main Question: As the title says, I want to sync my Google Calendar with the Linux Mint 17.2 desktop; preferably through Conky. I'm aware of a method using Thunderbird but I'd rather have it set up as ...
1
vote
1answer
60 views

How to install cctrlapp on debian?

I try to install the cctrl command line client on a debian 8 machine. Following the install instructions, I installed python, pip and then (via pip) cctrl apt-get install python apt-get install ...
3
votes
2answers
2k views

Using Python and Scapy to sniff for ARP on Pi

I'm trying to use a Raspberry Pi to find ARP requests from a specific wireless device on my network. It's one of those Amazon dash buttons. Someone used this code to listen to when the dash connects ...
0
votes
0answers
219 views

Script won't run in cron but runs fine in root shell

My Problem: I have a python script that runs fine when run manually but does not complete when run using cron. My script fails in cron because it contains pexpect commands that require an interactive ...
2
votes
1answer
71 views

Restrict user script execution

I have a game engine running on a Debian server. The game involves bots, which are coded in Python by the players. A player write a bot in Python Upon validation, the code is sent to the server A ...
0
votes
0answers
110 views

Capture user input in SSH

Say you are at work, you ssh to your home PC and opened a python game.py. No VNC. Is it possible to press down and up, space, etc. inside the window of the game? No need to see the actual game ...
4
votes
3answers
6k views

how to execute a bash command in a python script

How can I launch a bash command with multiple args (for example "sudo apt update") from a python script?
0
votes
2answers
344 views

How to install PyX correctly for Scappy use? [closed]

When I try to run Scappy interactive shell I am faced with this: INFO: Can't import PyX. Won't be able to use psdump() or pdfdump() (The shell is working but of course I can not use the above ^ :( ...
0
votes
0answers
181 views

Continuum Anaconda Fedora 22 path

After an update to Windows 10 caused problems in my dual boot system I had to reinstall Fedora 22. So, starting with a fresh system I reinstalled my work environment. The one installation that has ...
0
votes
1answer
239 views

Offlineimap unknown SSL protocol error

I am using offlineimap to fetch mail from several IMAP servers. This used to work but today offlineimap has been unable to fetch mail, producing the following errors: *** Processing account example ...
0
votes
0answers
140 views

Upgrade python from 2.4 to 2.6 on RHEL 5.7

Currently We have 2.4.3-56.el5 version of python installed on RHEL 5.7. Need to install nodejs for which the python version should be upgraded to python26. I have downloaded the below rpms: ...
0
votes
0answers
319 views

How to execute python script on Visual studio / Other Editor with Linux environment

as all know it is impossible to write long python script directly on Linux machine with vi editor so we use (win editor) tools as visual studio / Pycharm and so on .... so my question is how to ...