Skip to content
Advertisement

Tag: linux

Replacing ‘x..’ litteral string in Python

I have directories that contains ‘x..’ characters such as ‘x00’ : and I want to rename them without these, since when I copy those files to windows they become unusable. So my python script is going through those directories and detecting the problematic characters the following way: First I thought I could get rid of this problem by using the

Communicating via Bluetooth serial with Python

How do you process and receive serial data via Bluetooth and Python? I’m trying to make a simple Python server that access data via Bluetooth as explained here. My server.py file, which sends a random number when sent the text “temp”, is: When I first ran this, I was getting the error: which Googled showed could be fixed by enabling

Urwid: make cursor invisible

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

Unable to fake terminal input with termios.TIOCSTI

Most of the code samples I’ve seen are trying to read from stdin without local echo. To do this they modify the “local modes” flag to remove the setting to “Echo input characters”. I thought I could just modify the “input modes” flag to TIOCSTI which is for “Insert the given byte in the input queue.”. However, even though I

How to get PID by process name?

Is there any way I can get the PID by process name in Python? For example I need to get 3110 by chrome. Answer You can get the pid of processes by name using pidof through subprocess.check_output: check_output([“pidof”,name]) will run the command as “pidof process_name”, If the return code was non-zero it raises a CalledProcessError. To handle multiple entries and

Advertisement