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

learn more… | top users | synonyms

-2
votes
2answers
81 views

How to rename bulk of jpg files to png using convert

Let's say I have a bunch of .jpg files which I want to convert to .png. The file structure is as follow: 00-01.jpg 00-02.jpg 00-03.jpg 00-04.jpg 00-05a.jpg 00-05b.jpg 01-01.jpg 01-02.jpg ...
2
votes
1answer
81 views

Is it possible somehow to tell if a laptop is moved in a bash or python script?

I'm trying to figure out if there's a way to use a bash or python script to tell if my laptop gets moved. I had the idea of using wifi signal strength to do it, but the problem with that is that you ...
0
votes
0answers
74 views

How to validate server credentials in python

I'm new to python scripting. This is my sample script import pexpect import getpass import sys host = sys.argv[1] user = sys.argv[2] password = sys.argv[3] child = pexpect.spawn("ssh -l %s %s ...
1
vote
2answers
36 views

Rsync two “filepath” found by find commands [closed]

Original file /001day/backup/001m/name_test_v1.txt Destination file /001date/003m/name_test_v12.txt Method 1 rsync -av --progress /001day/backup/001m/ /001date/003m/ Method 2 ...
0
votes
2answers
211 views

How do I run a Python script on my web server

Hi I'm new to python programming. I have written python script and calling it in shell script. I want to run my script on my server that is hosted through somedomian.com I have tried by following ...
4
votes
1answer
401 views

is there a way to get the url from current tab in google-chrome?

I used to do that on firefox using a python command, but recently something changed and I can't get the URL anymore! What used to work with firefox: #!/bin/bash current_tab_num () { python2 ...
1
vote
1answer
332 views

How to programmatically add new crontab file without replacing previous one

I am working on a small home automation project using raspberry pi (OS -Raspbian). I want to know how to add more than one crontab file using python-crontab module without replacing the previous ...
0
votes
1answer
418 views

import: unable to open X server `' @ error/import.c/ImportImageCommand/361

I am trying to run a python script to generate heatmap and clustering dendrogram. But I got an error message saying : import: unable to open X server @ error/import.c/ImportImageCommand/361 I am a ...
1
vote
1answer
60 views

CGI error while trying to retrieve from sqlite3

I am trying to build a very simple login page, which asks the user for his register_no, username and password. And when he presses the submit button. I am trying to check whether it is an existing ...
2
votes
0answers
41 views

Why did this program install into ~/.local/bin … thats the first time I have seen that happen?

Why did this program install into ~/.local/bin ... thats the first time I have seen that happen? When I install this "Taurus Blazemeter 'bzt'" program, it ends up being installed into ~/.local/bin ...
1
vote
1answer
37 views

Can't run python libraries due to python 2/3 issues

I am running on a fresh install of OpenSUSE 13.2 tumbleweed which comes with python2.7 and python3.4. I am continually having problems running any python based libs in getting the following error ...
0
votes
1answer
98 views

How to compile Python with (Active)Tcl 8.6?

I'm trying to compile Python 3.5.0 on CentOS 6 with Tcl 8.6. I did ./configure --with-tcltk-includes=I/opt/ActiveTcl-8.6/include --with-tcltk-libs=L/opt/ActiveTcl-8.6/libs ...
2
votes
0answers
57 views

Why can't this Python script access XDisplay from Root terminal?

I need to run this Python script as below because it needs access to user's xdisplay: DISPLAY=:0 XAUTHORITY=/home/<USER>/.Xauthority su <USER> -c "python-script" The command above has no ...
0
votes
2answers
746 views

How to install Python on CentOS without root privileges?

For some reasons, I need to install Python on CentOS without root privileges. Since without root, one cannot use yum to install packages, so I tried ./configure --prefix=$HOME/tools/python make make ...
0
votes
0answers
17 views

unknown type name 'ffi_closure' while installing Python Ctypes

On my Media box I am trying to install python ctypes (needed to run some applications). When trying to install the package (via pip, easy_install or manually) I get the following error: unknown type ...
0
votes
2answers
209 views

Set Path for all Users (Login and Non-login Shells)

Ok. So, I'm used to Ubuntu and CentOS more than redhat, so I'm hoping there's some obvious solution to this that I'm missing. I've installed Anaconda (Python). I've placed it in: /opt/anaconda3 I ...
1
vote
2answers
78 views

Best practice to update own application

We're developing app for raspberry PI in python. We don't have much experience deploying apps in linux and we need to figure out how to update this app after releasing. We came up with 2 ways: make ...
1
vote
3answers
144 views

what could be the reasons for shell scripts kill itself?

I have shell scripts like #!/bin/bash while true;do #Code HERE! #Pushing Data to DB echo "Data to DB"> /root/schip.log 2>&1 done This is script is continuously running and ...
1
vote
1answer
79 views

What does Requires: Python(package) do for RHEL spec files?

I'm packaging some Python packages currently without RPMs, and some of those depend on others that I'm packaging. While packaging I noticed a format where people do: Require: python(pkg-name), but ...
6
votes
5answers
32k views

Execute shell commands in Python

I'm currently studying penetration testing and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are: echo 1 > ...
0
votes
0answers
139 views

why md5 encrypted password insert into php ldap admin extra {md5}

I am using python script to inter encrypted password into php ldap admin but the problem I am facing is LDAP add extra {md5} before the encrypted password, I simulated the code by creating two files ...
-2
votes
1answer
46 views

What is posix, and how can I elevate my permissions using python? [closed]

I was wondering if I could elevate my permissions on a chromebook with the os posix using a python script. I was not given the administrative permissions when I was given the laptop for college.
2
votes
2answers
101 views

Is it possible to pass arguments into a Python script?

I know how to pass arguments into a shell script. These arguments are declared in AWS datapipeline and passed through. This is what a shell script would look like: firstarg=$1 secondarg=$2 How do I ...
0
votes
2answers
49 views

How to install python on debian? [closed]

I'm new to Linux, so I don't know a lot of things, and I want to know how can I download and install python on my linux VPS (with SSH access).
0
votes
1answer
90 views

Encountered “error: command 'c++' failed with exit status 1” while trying to install pymedia in ubuntu

I'm trying to install pymedia in ubuntu to run scripts using python 2.7. So, I tracked down the dependencies and got them installed : sudo apt-get install python-dev libogg-dev libvorbis-dev ...
0
votes
0answers
15 views

I want to merge CSV files to one Excel workbook in different sheets. I want each file in one sheet with the CSV file name as sheet name [duplicate]

input: 1-example.csv a b c 2-example.csv 1 2 3 output: output.csv/.xls sheet1-data(1-example.csv) sheet2-data(2-example.csv) a 1 b ...
2
votes
1answer
88 views

Why do I have so many python versions on my mac?

I'd like to get into scipy and first setup my macbook air for python development. The problem is I have many different versions of python installed - here is what I get when bash autocompletes "pyth": ...
0
votes
0answers
206 views

Python 3.4 & 3.5 glitch

I recently installed Python 3.5 from source code on elementary OS Freya. Without removing Python 3.4. For some time things ran fine, later they turned nasty. for example pip installs the packages at ...
1
vote
1answer
56 views

`man` pages for languages other than C (e.g, python, R, javascript, etc)?

man pages are a phenomenal resource while programming in C on Linux. While looking at someone else's code, if you see something foreign you can immediate research it in another terminal with $ man 3 ...
1
vote
0answers
313 views

Python is unable to import OpenSSL

I created a virtual env for a matrix home server installation on a shared hoster. $ virtualenv -p python2.7 /home/tristank/venv/synapse $ source /home/tristank/venv/synapse/bin/activate I installed ...
0
votes
2answers
182 views

How to check if a module or a package is already installed in python3?

Need to verify whether it is installed or not before the program can run.
0
votes
1answer
35 views

Terminal Software to add Watermarks to Videos?

I have a bunch of videos, 12,000+ a month. I would like to add a watermark to all of them, like a logo with our website. Is there any software I can use on the Terminal to do this? Ideally I'd like ...
1
vote
1answer
822 views

Running a python script 200,000 times in parallel using bash [duplicate]

I need to run my Python script 200,000 times. Is it possible to do parallel execution using bash? Since it's 200,000 times I would like to use at least 10 threads simultaneously
1
vote
3answers
1k views

Copy and get files from one machine which is connected via ssh to another one

I read a lot of answers to questions very similar to this one, but I couldn't find something that really fits my problem. Here's the situation. I have a machine whose address is "machine1@address", ...
1
vote
2answers
58 views

If I want to create a GUI which displays exactly the same data as TOP command does in LINUX, where do I get the data from?

I found out that I can get the PID(first column) from the /proc/[pid]/stat file, first column. I am not sure where can I find the rest of the attributes. And my guess is we need to calculate the %CPU ...
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 ...
0
votes
1answer
597 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
2answers
481 views

How can I switch between Python 2.7 and 3.4 that are installed on Debian 8 (Jessie)?

I'm using Debian 8.2 (Jessie), and have both Python 2.7 and 3.4 installed. Python 2.7 is the default and that's what is used when I run a Python script or interactively in the Terminal. How can I ...
1
vote
1answer
314 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 ...
4
votes
1answer
109 views

Where is the default device name (e.g. /dev/ttyUSBx) specified?

I'm investigating dynamic device name mapping via udev. The goal: On a multi user system, each user can allocate and free devices like usb-serial converters or PCIe cards (FPGAs). If an user ...
0
votes
1answer
88 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
30 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
81 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
743 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 ...
0
votes
1answer
98 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
134 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 ...
0
votes
0answers
128 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 ...