Tagged Questions
1
vote
0answers
22 views
How to intercep each line of stdout after issuing a command at prompt with python
I have written a python script that is doing the flowing;
Connect to a LUN
Mount the drive
Backup my home drive to that LUN
All of the above is saved in a log file, everything is working as it ...
0
votes
1answer
15 views
python ctypes foreign library initialization and uninitialization
I am wrapping this c library called pvcam (Photometrics Virtual Camera Access Method) in ctypes and for the most part it works. The problem is I cannot get the library to uninit. When ever I try to ...
0
votes
0answers
18 views
Fail to install Python with “error: C compiler cannot create executables”
I want to update my Python to version 2.7.8,and here occur the error:
jharvard@appliance (~/Downloads/Python-2.7.8): ./configure
checking build system type... i686-pc-linux-gnu
checking host system ...
0
votes
0answers
19 views
R-pi running a gpio script on boot
I have a script that needs to run when the raspberry pi boots (Raspbian- latest version, the pi is a model B+). The script needs to be none-blocking, and accesses the GPIO pins, so needs to run as ...
1
vote
1answer
10 views
GNOME: Inhibit shutdown while backup is running
System: Debian 7 32bit
I'm trying to prevent the shutdown of my laptop during backups (obnam), and I think I can use inhibit to do so.
I found information on how to do this here, but when I execute ...
0
votes
2answers
47 views
Python script works run from dir but not as CLI cmd, despite setting $PATH and shebang
Please skip straight to EDIT 3 for the cause of this problem (end of this post)
TL;DR — the editor did not save the shebang line, though I'm not sure why.
I've made a script that just cleans the ...
0
votes
1answer
19 views
raspberry pi bluetooth and lego mindstorm
I am trying to get a lego mindstorm ev3 to communicate with a Raspberry Pi. I am able to get the mindstorm to send data to the Pi but the data is not human readable. My end goal is to be able to send ...
1
vote
1answer
17 views
Conda build a 32 bit package on a 64 bit machine
I have been using conda as a package manager for a lot of my work and its really helped keep the environments of multiple people in check with both Python and binary packages. Its been all sunshine ...
0
votes
0answers
9 views
How to filter recorded X events with Python Xlib
I need to be able capture system-wide key shortcuts (media keys) for my media player app. On Windows I am using pyHook module which can filter or pass caught event. I was looking for universal ...
-1
votes
2answers
34 views
python - ctypes error with mysql c
I create a library with c, but when I call the library in python shows me the following error:
Traceback (most recent call last):
File "probrar_lib.py", line 6, in <module>
lib = ...
0
votes
1answer
35 views
Using Python to create SFTP users in linux
I created the following to create SFTP users in a linux server. Is there a better way to implement this? The script works by generating a username after checking if the user already exists. Then ...
0
votes
0answers
13 views
Missing libpython2.6.so.1.0 after install
I am currently trying to run a piece of old software that was originally built on a cluster using Python2.6 libraries. During the installation of that program, Python2.6 was specified as the Python ...
0
votes
3answers
46 views
Crontab for sending mails
I created my send_newsletter admin commands with django, when i'm using the
python manage.py send_newsletter
it works.
My send_newsletter.py
sys.path.append('/srv/apps/')
...
0
votes
0answers
15 views
OpenCV windows always minimized on Linux
i have a problem with OpenCV in Python2 on Linux. Whenever i open up a window, it starts minimized. Is there any easy way to force the window to start on top?
my code:
import cv2
video = ...
0
votes
0answers
16 views
pypyodbc doesn't connect when isql does?
pypyodbc has worked for me in the past, but for some reason it's not working. I have this defined in ~/.odbc.ini
[as400]
...
0
votes
2answers
42 views
How to keep run Python Program in Background on Raspberry Pi after terminate ssh
i need to keep run my Python Program in Background on my Raspberry Pi after i close the ssh connection, Because i need to save Phidget information on a SQL DB
I try to do this with nohup but it seems ...
-2
votes
0answers
17 views
beautiful soup - multiple URLs from Linux Terminal
So I'm trying to crawl multiple URLs with Beautiful soup, it's looking for certain html tags (title, meta, content and date). I can get it to work with a single URL but not with two. I imagine this ...
0
votes
2answers
16 views
Executing reboot command over SSH using Paramiko
I use Paramiko for establishing SSH connection with some target device and I want to execute reboot command.
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
...
0
votes
0answers
8 views
How to start redis server and config nginx to run mediacrush script on CentOS?
I found a MediaCrush open source from here
https://github.com/MediaCrush/MediaCrush
But stuck in last steps.
I started the Redis server, use command
$redis-cli
that received the "PONG" ...
0
votes
1answer
29 views
Python/C API gcc compile warning unused variable
I have been trying to embed python into c. I am on Linux Mint 17 and installed python-dev. I have been following the documentation on https://docs.python.org/2/extending/embedding.html I was able to ...
1
vote
1answer
42 views
How do I invoke a text editor from a command line program like git does?
Some git commands, git commit for example, invoke a command-line based text editor (such as vim or nano, or other) pre-filled with some values and, after the user saves and exists, do something with ...
-1
votes
1answer
38 views
Bash script transfer to Python - copy logs from server to another remote server
I have done my easy script in bash - this script should transfer the file with the specific new name from server 1 to remote server 2.
Can someone help with this and transfer all script to Python.
...
0
votes
1answer
34 views
Python show all installed packages
Is there a way for python to show all apt/yum packages installed on a server? I have a program that can only grab one package that I specify but I'd like to know if there is a apt-show-versions/yum ...
0
votes
0answers
27 views
Trouble with Python Libraries Between Different Nodes
I am trying to run a python script on a linux box with a specific version of python and I'm having some trouble. Every time I try to run the script on the linux box I get the traceback pasted below. ...
-2
votes
0answers
21 views
creating folder every day in the name of the current date in python
i am doing a simple timelapse photos that will be uploaded to a ftp server. I am trying to upload it by Current date named folder created everyday but i am missing something and i am getting error as ...
2
votes
0answers
42 views
Resource leak when launching subprocesses with subprocess.call()
I am writing a Python crawler to clone git repositories and analyze them. I am using subprocess.call() to clone a given repository. The problem is that after only a few repositories, I get a "OSError: ...
0
votes
0answers
39 views
Easy_install https unknown url error in python 3.3
I'm installing python 3.3 on Suse Linux EC2 instance on amazon. The instance has already python 2.6 installed, so after installation of python 3.3 I work on virtual environment.
When I run ...
0
votes
2answers
26 views
print in new terminal window
i wrote an script that have multiple threads and in this threads i used "print()" code to print log activity about that thread, but the problem is i don't want to print all these logs at one terminal ...
-3
votes
1answer
48 views
Why (0x7FFFFFFF >> 31) + 1 is zero?
In python command line, it gives 1 and I want this answer.
But 'Putty' gives me 0, and I don't know why? Could you guess?
0
votes
1answer
45 views
How not to allow pygame to change my screen resolution in Linux?
I've recently written a shell script which boots my Windows Python application with wine:
#!/bin/sh
wine data/Python/x86/python.exe loader.py 'x86'
While the program is running, everything works as ...
0
votes
1answer
19 views
How to list all types (running, zombie, etc.) of processes currently in linux with native python library
I want to list all processes' information currently exist in Linux system. I find that someone uses psutil library to accomplish this task. However, my development environment can only support native ...
0
votes
1answer
45 views
How to keep a script running all the time in linux?
I'm trying to run a simple python script all the time. I want it to start automatically on bootup and be able to recover from failures. That is, if there is a failure that causes the script to stop, ...
0
votes
1answer
17 views
python cron job error in centos 6.3
i am running scrapy 0.24.4 and it need python2.7.
so i install python2.7 in /usr/local/bin/
and create name.sh file to run my script:
cd /home/user/public_html/dir/
...
0
votes
0answers
14 views
getting lists of hosts connected to router
I am trying to create a python script which logs ip addresses of user connected to router after period of time so that I can use this data to trigger some programs. I try using arp-scan and scrapy ...
0
votes
0answers
42 views
Get free space of a directory in linux
I have a question. In my c# application I need to get the free space of a directory. According to my research, GetdiskfreespaceEx is proper and it works for me in my windows xp. Now I'm wondering if ...
0
votes
1answer
38 views
Python open a file in a subdirectory - linux
Is it possible to open a file for reading in a sub directory without having to use os.listdir()? Something like this maybe?
f1 = open('/SCRIPT/PYTHON/monomer-b/{}'.format(xyzfile)).read()
I am ...
0
votes
1answer
12 views
How to get mysql on an ec2 centos box with upgraded python
I'm trying to get to a MySql database through python, starting with a centos ec2 instance with python upgraded to 2.7 from 2.6. It's not working because my gcc compiler cannot find a the python header ...
0
votes
1answer
68 views
How to make system see freshly installed Python 2.7.8 on Ubuntu 12.04 (precise)
Summary: Several utilities do not work after I installed more recent python on my Ubuntu machine. Why?
My only experience with Linux is Ubuntu 12.04 and so far I've relied on apt-get primarily for ...
1
vote
1answer
35 views
Loading the data in memory to get faster response
I am using svm classifier, which classify the data using learned model. Here is the command I execute:
./svm_classify input.txt modelrank > input.txt.entities
svm_classify - is the opensource ...
-1
votes
2answers
32 views
How to use python to run a list from one file through another script
Alright, so I am being tasked with a large task of auditing the use of our IPs in my office because we are running low. So I am trying to write a basic script that takes a list of the IPs I need to ...
0
votes
1answer
33 views
Flask can't read the /etc/environment
I am getting a problem with the credentials of gmail in flask.
If I use this:
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
I will get this error:
...
6
votes
1answer
357 views
gdb pretty printing with python a recursive structure
I'm not very familiar with Python, and I am just discovering GDB python scripting capabilities; the motivation of my question is to enhance the GDB printing of values inside the MELT monitor which ...
2
votes
3answers
14k views
Running a python script from PHP
I'm trying to run a python script from PHP using the following command:
exec('/usr/bin/python2.7 /srv/http/assets/py/switch.py arg1 arg2');
However, PHP simply doesn't produce any output. Error ...
3
votes
1answer
1k views
Launching an app in heroku? What is procfile? 'web:' command?
I was referring to this site as i am learning python/flask and trying to use heroku.
http://ryaneshea.com/lightweight-python-apps-with-flask-twitter-bootstrap-and-heroku
Let me explain what all I ...
2
votes
2answers
2k views
Simulate Ctrl-C keyboard interrupt in Python while working in Linux
I am working on some scripts (in the company I work in) that are loaded/unloaded into hypervisors to fire a piece of code when an event occurs. The only way to actually unload a script is to hit ...
0
votes
2answers
450 views
Linux gui automation api in python
I need an api which will allow me to automate actions such as: Closing a window, activating a button, or bringing a window to the front. I need to be able to use it from python, and it needs to be ...
100
votes
18answers
68k views
mysql_config not found when installing mysqldb python interface
I am trying to get a Python script to run on the linux server I'm connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to install mySQLdb via ...
25
votes
4answers
25k views
How do I run Selenium in Xvfb?
I'm on EC2 instance. So there is no GUI.
$pip install selenium
$sudo apt-get install firefox xvfb
Then I do this:
$Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
$DISPLAY=:1 java ...
32
votes
3answers
18k views
How do you set your pythonpath in an already-created virtualenv?
What file do I edit, and how? I created a virtual environment.
2
votes
1answer
1k views
Is there any python package that could configure IP address of network interface?
I am writing a server application which allow remote client to show/add/change/delete IP addresses of network interfaces of the machine where the host is running.
The OS is Linux(CentOS 5.2), so I ...