4
votes
3answers
304 views

Bash / Python error handling?

I am trying to execute very basic Python code containing error handling as a Bash script, but while the code seems to run OK in Python, the code generates problems when executed under Bash. ...
0
votes
0answers
30 views

getting error in opening py file [duplicate]

I'm installing a software in Ubuntu 12.04 and got the following error: http://paste.ubuntu.com/7638369/ server@ubuntu:~/Desktop/revkit-1.3$ ./tools/gui/gui.py Traceback (most recent call last): ...
0
votes
3answers
54 views

alias/function with command line arguments

I'm tired of typing manage.py startserver 10.211.55.4:4000, so decided to make an alias for that. Only thing is: the port sometime changes. So I did this in bash profile: function runserver() { ...
1
vote
3answers
216 views

Python command in bash does not find -c flag

I have two python lines in my bash script, both should run with -c flag, but once I run the Bash script it tells me that it could not find -c flag that is needed for python to run the command in Bash. ...
0
votes
0answers
30 views

Bash if password filled save it

I am trying to save a password to gnome keyring via python script. The python script will be runned from bash script if password is filled in zenity GUI. Example: User inserts hes/hers password to ...
1
vote
1answer
103 views

How to install RevKit

I’m trying to install a software called RevKit on Ubuntu 12.10 and the following instructions1 need to be followed: RevKit can be downloaded from the www.revkit.org website. Opening a Bash ...
1
vote
1answer
46 views

Why cant I install NLTK? [closed]

I am trying to install Natural Language Tool Kit for Python on my Unix machine as per the below: http://www.nltk.org/install.html however when I get to .." sudo pip install -U numpy" I get the ...
0
votes
2answers
73 views

lscpu output differs when called indirectly?

I use lscpu | grep 'MHz' to get my clock speed. I am getting different results based on the method I am calling this command. Method 1: typing it in the terminal CPU MHz: 1200.000 Method 2: ...
1
vote
0answers
51 views

nproc returning two values on python [closed]

I'm trying to write a script to do something that I repetitively do everyday, and that for it to be useful I need the value given by the command nproc. The problem is that nproc on bash returns my ...
0
votes
1answer
154 views

finding amount of memory usage of a command in bash

I wrote a program and now I need to measure it's performance so I use time to find timings but is there any command like time that I could run my program under it and have the amount of memory used by ...
2
votes
2answers
34 views

Scripting bzr commands

Can someone push me in the right direction to either use a shell script or Python to make a script to simplify pushing a bzr branch to launchpad? The script process would be simple: cd ...
0
votes
2answers
296 views

How to change environmental variable permanently?

I am trying to use third party packages in Python. To import all the modules I need to update PYTHONPATH. I read several blogs on it but still I have following questions unanswered. Is sys.path ...
2
votes
2answers
1k views

what could cause a script to fail to find python when it has `#!/usr/bin/env python` in the first line?

Trying to get casperjs running on Ubuntu 12.04. After installing it when I run I get: 09:20 $ ll /usr/local/bin/casperjs lrwxrwxrwx 1 root root 26 Nov 6 16:49 /usr/local/bin/casperjs -> ...
1
vote
1answer
61 views

How to block all the interrupts in linux

I am working on a python project, Where i am displaying a graphical window with log in screen, I've also disabled the close, re size and minimize buttons My problem: I have to disable all the ...
3
votes
1answer
240 views

Command completion in R and python

In bash terminal, I could configure the command completion by inserting these lines to the /etc/inputrc file: $if Bash # Search history back and forward using page-up and page-down "\e[5~": ...
0
votes
1answer
139 views

Executing script from shell problem

Lubuntu Raring Ringtail. I want to be able to execute my scripts with ./ I start my python script with #!/usr/bin/python and it says bash : ./myscript.py: /usr/bin/python^M: bad interpreter: No such ...
1
vote
1answer
654 views

Set CLASSPATH for python

I want to execute a python file called "ex1.py". The execution works fine, the program does, what it ought to do. The problem is the following: This file is stored in the folder ...
0
votes
1answer
460 views

Check if torrent file is complete before copying

I have a crontab command that daily copies .iso files found within my torrents folder into an iso directory on a separate partition. My problem is that multiple .iso files will still be in the process ...
2
votes
1answer
174 views

Is it possible to make a python script that runs on a specific terminal-profile

I have this python script that connects my desktop to the internet. there is not much text in it only a few messages about current status and time. So it would be really nice if i can open it (.sh ...
2
votes
2answers
123 views

How can I get diffuse to play well with a Python virtualenv?

Diffuse is installed on my workstation and plays well with Mercurial so I often use it for diff'ing. However, I also am using a Python virtualenv to use some different modules in a more controlled ...
0
votes
1answer
959 views

How to run a shell script without terminal

I have a shell command that executes a command and sends it through pipe to a python file. The python file does various checks on it and then starts processes with parameters using subprocess.Popen. ...
2
votes
1answer
1k views

running gnome-terminal with no window border on startup in xubuntu 12.10

I created a script to launch a session of gnome-terminal when I log into xubuntu. I specifically wanted it in a specific position on the window, and with no window borders (surprisingly, there's no ...
3
votes
2answers
523 views

How do I run a py file with pico in the terminal?

I got this when I tried to open a .py file on the terminal line I edited in pico: lightning@rigel5:~$ ./hello.py bash: ./hello.py: Permission denied How can I easily open a .py file from the pico ...
46
votes
3answers
3k views

Is #!/bin/sh read by the interpreter?

In bash or sh, I guess anything which starts with # is a comment. But in bash scripts we write: #!/bin/bash And in Python scripts, there is: #!/bin/python Does this mean that # by itself is a ...
4
votes
2answers
550 views

Unable to set background image using python (2.7.3), bash and gnome3

#!/usr/bin/env python import os bashCommand = "gsettings set org.gnome.desktop.background picture-uri file:///home/malon/autowallpaperchanger/" + pic_name print bashCommand os.system(bashCommand) ...
0
votes
1answer
190 views

How to programatically fetch the download status of Google Chrome?

How would I go about determining if Google Chrome is downloading something, and getting the "percent-done" value of that download, from the terminal using a Python, Perl, or Bash script?
3
votes
2answers
2k views

Python Compared to BASH

I've been studying bash for the past three weeks or so, and it is very easy to learn since it is basically just command line inputs. I've decided to now move onto python but I've been lost the whole ...
6
votes
6answers
18k views

How do I change my PYTHONPATH to make 3,2 my default Python instead of 2.7.2?

I have python3.2 located in /usr/lib/python3.2. I am not sure if that means it's installed but I assume it is for now. Some facts about my system: $ which python /usr/local/bin/python When I type ...
2
votes
1answer
189 views

Gnome Tweak Tool editable via bash/python?

Is there a way to access the variables to edit via bash (or other libraries with bash or python)? Similar to how you can use 'gconftool-2' in bash to edit properties that would update them after ...
3
votes
1answer
551 views

Load configuration from XML (Xfconf)

I'm trying to make an app to switch your XFCE4-Panel's layout between 3 layouts. I applied those layouts and copied the XML file where Xfconf stores its configuration for the panel. The general idea ...
2
votes
1answer
1k views

Typing commands into a terminal always returns “-bash: /usr/bin/python: is a directory”

I think I messed something up on my Ubuntu server while trying to upgrade to Python 2.7.2. Every time I type in a command that doesn't have a response, the default from bash is this: -bash: ...
5
votes
2answers
557 views

How to re-start a python script without killing other python processes

I develop an app called Unity Mail. A quicklist option «Edit accounts data» needs to restart it. File /usr/bin/unity-mail: #!/bin/sh python /usr/share/unity-mail/unity-mail.py $@ File ...
3
votes
2answers
1k views

Shell script to restart a process if it outputs a certain piece of text

I have a python program which, from time to time, crashes with a number of different exceptions usually due to network issues. The only way to get it to work is to restart it. How would I write a ...
1
vote
1answer
2k views

Pipe error with bash script called from python

I'm trying to run a shell script inside some python code, but I keep getting an error message. Python script (test.py): import os f = os.popen('/home/test/Downloads/record.sh') f.close() ...
5
votes
2answers
4k views

What is the default character encoding?

I don't myself know how deep this question actually goes (for example, for all I know there could be several, depending on my task). Particularly, I am interested in what kinds of strings are used to ...