I’m using urwid, which is a Python “framework” for designing terminal user interfaces in ncurses. There’s one thing though that I’m not able to do in urwid that was easy in curses – make the cursor invisible. As it is now, the cursor is visible when selecting buttons, and it just looks plain ugly. Is there a way to disable
Tag: python
Redirected output from a subprocess call getting lost?
I have some Python code that goes roughly like this, using some libraries that you may or may not have: Basically, I’m starting a subprocess that’s supposed to go download some data for me and print it to standard out. I’m redirecting that data to a file, and then, as soon as the subprocess call returns, I’m closing my handle
Root autentication on a Python program
I have the root password saved in a variable. How I can give the root authorization at my program? This can be an example: Answer It is impossible to do it in the way you try. Your program is already started under some non-root user and you cannot change it inside this program. You can spawn other process which will
How to GREP words, not lines, that contain specific characters, and print entire word
I have a file with tons of lines and words such as this example: What I want to do is list only the word (assuming each 4 character bundle is a word) that contains a specific number, such as 35. In this example, I would want the result printed to be: I have tried a few different ways such as
How can i execute comm Linux command in Python
I want to extract lines from File1 which are not present in File2 File1 File2 so the output should be: One possible command in bash is: And it works perfectly well in bash, but I don’t know how correctly to implement in Python. I’ve tried with And is not working. Any hint? Answer If you must use a shell, do
Curses snake game not removing cells in linux os
It’s code from a curses tutorial that I’ve been using to get a grasp of it but even though I’ve checked the code multiple times, it’s still not removing the old cells. The guy that wrote the code is on a mac and I’m using linux so would that be a problem? Answer The problem seems to be near the
Installing setuptools from source “No module named numbers” error
This is based on Install Python Flask without using pip My environment has no rpms installed or enabled, nor do I have pip, easy_install, virtualenv, etc. Based on the answer in the linked question, I need to install setuptools in order to install Jinja. To do this, I downloaded and un-tared setuptools-19.1.1.tar.gz. I then run the following command and get
autossh not working when executed in python
I am trying to create ssh reverse tunnel. When I run the below command on terminal it works greate: But when I run it in python with os.system() or using subprocess it’s not working. When I check the processes list the process is created and running and has no difference with the last method.(running directly in terminal) python code: Any
How to register a signal handler for a subprocess?
Adding a signal handler, e.g. with process.sh doesn’t work because CtrlC interrupts the child process (only SIGINT received is printed), but both SIGINT received and SIGINT child received should be printed and the child continue to run. Adding signal.SIG_IGN leaves the child untouched, but that not sufficient since I need to write a custom handler for the child. I don’t
How can I run a python script on many files to get many output files?
I am new at programming and I have written a script to extract text from a vcf file. I am using a Linux virtual machine and running Ubuntu. I have run this script through the command line by changing my directory to the file with the vcf file in and then entering python script.py. My script knows which file to