Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

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

0
votes
0answers
6 views

RHEL upload / pull scripts from people without access to the server itseld

I have a RHEL Server and would like to enable a group of users to be able to upload / modify mostly Python script that enrich data in our ticketing system. The problem is that they can't have access ...
1
vote
1answer
16 views

No module named yum CentOS6

I think I messed up my python config now yum wont work. I'm getting error 'No module named yum'. I have tried editing /usr/bin/yum and adding #!/usr/bin/python2.6 as the interpreter but this has not ...
-1
votes
0answers
6 views

uWSGI workers crashing every minute

I have a flask/uWSGI/nginx based python app and for some reason I have the workers restart on me every minute. Here's the uwsgi log: Gracefully killing worker 1 (pid: 2120)... *** Starting uWSGI ...
0
votes
2answers
18 views

How do I install pip on CentOS?

I'm using CentOS 7. I want to use Pip to install a virtualenv . So I installed Pip like so ... [laredotornado@server Python-3.7.2]$ sudo yum install python-pip httpd mod_wsgi [sudo] password for ...
0
votes
2answers
23 views

How to create a shell dictionary from an output of a python script?

My python scripy print a string by print("declare -A gaps=( [2019-2-24]=4 )") and I can run declare -A gaps=( [2019-2-24]=4 ) on a bash shell to create a dictionary named gaps. In my bash script, I ...
0
votes
1answer
25 views

Trying to save a photo with python, but when I execute the program with the terminal, It returns that there is no such directory [on hold]

I have been trying to execute this program: 1 import PIL as pillow 2 from PIL import Image, ImageFilter 3 photo = Image.open("index.jpeg") 4 b = photo.filter(ImageFilter.BLUR) 5 b.save("/home/...
1
vote
2answers
71 views

How can I extract only the pid column and only the pathname column in the lsof output?

$ sudo lsof -u t | grep -i "\.pdf" evince 1788 t 37r REG 8,4 176328 134478 /home/t/some/path1/white space/string1 + string2 string3.pdf evince 3737 t 36r ...
0
votes
0answers
20 views

Best way to get rid import error in `vim-latexsuite`

I'm running Arch Linux and I have the vim-latexsuite package installed. A while ago I noticed started getting an error whenever I opened a .tex file: Traceback (most recent call last): File "<...
0
votes
0answers
9 views

Openshift post deploy script with nohup [migrated]

I am writing python Flask web application which I am deploying on Openshift in container (Python S2I image). Then, after deployment, I want to run 1 python process and 1 celery worker. I am using for ...
1
vote
3answers
43 views

How do I control which command is when i type python in the shell

I use anaconda as a way to handle virtual environments. This means I have multiple version of python installed. I experience that the wrong python version starts when I run python from the shell. ...
0
votes
0answers
5 views

serialport read data empty dataspace from output on pycharm console [migrated]

hi here im trying to write(write.py) and read(listener.py) on same port Im able to get data while running listener.py but wich is and empty space i tryed to send byte string from write.py and on ...
-1
votes
0answers
23 views

subprocess popen invalid syntax [closed]

When I run this script: for usr in usrname: print usr cmd = (grep "$usr" /etc/passwd | cut -d ':' -f 5) p = subprocess.Popen(cmd, stdout=...
0
votes
0answers
14 views

How can I get python to remember an input by a certain name? [migrated]

I'm relatively new to Python, and am in the process of making a virtual diary project. I have reached a point where if the user asks to write an entry, the date and "Dear Diary" are printed, and they ...
1
vote
0answers
27 views

Compiling python with custom library path [duplicate]

I'm trying to install the latest Python version on my workstation at work. Unfortunately I don't have root access, and they won't do it for me, so I have to compile from source and put it in ~/local/...
-1
votes
0answers
24 views

Restore PDF accidentally rewrote [duplicate]

We accidentally rewrote some pdfs with this code : f = open(path_file, 'r', encoding='ISO-8859-15') content = f.read() f.close() .... f = open(path_file,'w', encoding='ISO-...
0
votes
1answer
17 views

want to install PyQt5 for slitaz

I want to run an application that need python3 and pyqt5 in Slitaz 5. I am not pro in linux but managed to compile and install python3. now when I try to run application it tell me that need pyqt5. so ...
1
vote
1answer
27 views

How do I properly change the debian default python 2.7.9 to python3 or another version? [duplicate]

what is best-practice for changing the default global python interpreter on my fresh debian-based linux node to python3.x? When I create a fresh Debian or Ubuntu VM, one of the first things I do is ...
0
votes
2answers
31 views

How can I make python detect missing packages or apps [closed]

I'm making a script for Ethical Hacking purposes and I want to have a first function that detects and shows the user what packages they need to install before they can continue. For example, I would ...
0
votes
1answer
59 views

python -c “print calculation” gives syntax error

I was doing some bash scripting and adding some python for float calculations like divide, deductions When I am executing this, all part is running fine but for some python part it is showing me an ...
2
votes
2answers
51 views

Solaris : Sort numerical values

I have a file with following values. keyword1 19.02 1.69.94 keyword2 19.01 1.68.118 keyword3 19.02 1.69.119 keyword4 19.01 1.68.115 keyword5 19.02 1.69.304 keyword6 19.02 1.69.39 I want these to be ...
1
vote
1answer
26 views

Parent process blocking trying to read output from zombie child process

The setup: I have a python (3.6) script (call it "operator") that executes a bash script (call it "plunger") in standard subprocess ways, collecting and logging stdout from the child. The plunger ...
1
vote
1answer
25 views

Compare two text files, extract matching rows of file2 plus additional rows

have been mocking around with this too long and tried grep, join, awk but I cant get the parameters right. I need to get the command right. I have got two text files. cat file1 @ABC:11:ABC:1:...
0
votes
0answers
11 views

Killing a thread in Python (which is descendant of current process) [duplicate]

Normally, Linux threads cannot be killed outside the main proces's scope, except by killing the main process itself, however, I need to do so. I made a threaded program which needs to have a complete ...
0
votes
1answer
12 views

python Ovirtsdk api, how to start a vm in paued mode

I am trying to start a vm in paused mode, but running into issues. I'm able to connect to the API and start vms normally, but I cannot seem to get the params part right for staring paused. In this ...
1
vote
0answers
14 views

Calling a c library function from within ctypes python [migrated]

Using nm, I get these functions back from my library: 0000000000004bc0 T __Z13generator_sind 0000000000004120 T __Z13librador_exitv 0000000000004080 T __Z13librador_initv 0000000000004b70 T ...
2
votes
3answers
73 views

Extract every 2 lines from a 40 lines file and create a new file

I have a file with 40 lines like this: 0001.Group admin_group 0001.Users adam, sam, paul, david, jennifer, harry 0002.Group Dev_group 0002.Users mike, pauli, gary, sherry 0003.Group ...
3
votes
0answers
52 views

In Linux, is there a way to automatically mount a drive when it is inserted? [closed]

I'm trying to automatically mount a drive when a user inputs it and show the progress on my web page so I will be translating this into my python code. Using Linux commands - What would you have to ...
3
votes
1answer
42 views

Unable to initialize environment variables on startup

I have written a python script that runs successfully on raspberry pi if it is run manually from the console. As I want to start the script on reboot, I've written a bash script to change directory, ...
0
votes
1answer
54 views

How can I run the sudo command in Python code under CentOS in Docker

I am trying to access the docker image labels from Python as follows hostname = socket.gethostname() cmd = "sudo curl --unix-socket /var/run/docker.sock http:/containers/" + hostname + "/json" output ...
2
votes
2answers
42 views

Different order for getsockopt SO_PEERCRED in Linux and OpenBSD

I'm trying to get the Unix socket peer credentials in python. I am using this piece of code for that: peercred = conn.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, struct.calcsize("3i")) pid, ...
0
votes
1answer
68 views

How to make python3.7 default

I have installed python3.7 however I am not sure how to make it the default python. See below: ~/Documents/robosuite$ python3.7 Python 3.7.1 (default, Oct 22 2018, 11:21:55) [GCC 8.2.0] on linux ...
1
vote
0answers
45 views

Running python commands in a py/text file in Linux terminal using flask shell

Is it possible to run a python file using flask shell similar to python? Similar to: flask shell myfile.py flask shell -f myfile.py That's all I get when using $ flask shell --help: Usage: flask ...
1
vote
1answer
39 views

Is there a fast tool to show all the unique unicode characters in a file and their count?

Does anybody know a tool to tabulate all the unique unicode characters and their counts in a file?
0
votes
0answers
50 views

how to install pip for python 2.7?

I followed the link @https://linuxize.com/post/how-to-install-pip-on-centos-7/#2-install-pip to install pip ,however its intalled for python 2.6 that comes with the system,how do I install it for ...
0
votes
1answer
44 views

Python project not able to find file [closed]

I'm working with a python file that requires two pictures as an input and returns another picture which is the result of the first two. Using the terminal you are supposed to input the file path to ...
0
votes
0answers
15 views

python argparser use nargs to capture colon seperated input for a single option [migrated]

I have below code on a transfer script to capture source and destination, i am successfully able to get the input like this using below cod python program -s "source host" "source folder" -d "...
0
votes
0answers
22 views

Open MP3 sound file from python [migrated]

I have VLC installed on my raspberry pi 3. I want to be able to run a python file that opens a mp3 sound file (my_sound.mp3) and plays the sound. The closest that I got is: import os import ...
0
votes
0answers
38 views

Changing permissions in a Unix directory

I am not able to change permission on a directory I created on the Unix server. This is how the structure looks $ ls engany N832342 N854431 zabbix $ Now I want to change the permission in ...
0
votes
0answers
22 views

Filter output / print one record per event or time period

I've got a custom HID device which prints out exact coordinates of touched points at real time. It is very sensitive & currently printing out the coordinate that's being touched on multiple ...
0
votes
4answers
61 views

Get the command that generated piped data

I'd like to figure out a way to access a string describing the command that was run before the current command running. For example, if I run: ls | myscripthere I'd like to be able to know that the ...
1
vote
2answers
31 views

Speeding up repeated python calls (or, alternatively, porting a complex regex to sed)

I am an academic medical physicist. I do experiments that generate a fair amount of data, and they are expensive to run. My university has a backup system that consists of a robot tape library in a ...
0
votes
1answer
22 views

how to concatenate all lines in file that start with //! to make them into one line in python

so the file looks like this void funct_example ( int stamo) { //! ID{SWERT- 12345} this is function that is suppose to take //! IDREF{SYA-dfjk} return(stamo) } void funcert (string ...
0
votes
1answer
101 views

Pip invalid syntax error in RHEL

I'm trying to use pip to install python packages on an RHEL instance but get this error when I try to run any pip command. Pip did previously work but all of a sudden (not sure what I did) it started ...
1
vote
1answer
15 views

Why might re.search process these patterns differently?

I regularly use sagetex, which is written in python. One of the scripts in the package defines a variable like this: ignore = r"^( _st_.goboom|print 'SageT| ?_st_.current_tex_line)" The script ...
4
votes
1answer
169 views

debian 8 (jessie) - virtualenv with python3.6

so i have a fresh debian install. I installed pythons 3.5,3.6,3.7: root@m2:~# apt-get install python3.{5,6,7}-dev and try to set up some virtualenvs: for i in 5 6 7 ; do dir=venv3.$i; echo $dir; ...
1
vote
0answers
49 views

Running Telegram bot on Linux VM Azure [closed]

I am running a python Telegram bot on Azure, and it does not work at all. It does not connect to Telegram as it does not respond to commands. I am certain it is not the code because someone tried it ...
0
votes
2answers
56 views

Terminal rendering and application performance

I'm running Mint 19 with cinnamon, but i think its a general question for any linux desktop environment. I have a python CLI application which has a lot of terminal output, so much, that the print ...
0
votes
0answers
24 views

Terminal Hangs when running bot

I have a bot installed on my Azure Linux VM running Ubuntu 18.04. I am running the command to start my bot, and it returns an error (see below). The console freezes as well apparently because it ...
0
votes
0answers
30 views

-bash error when trying to run bot [duplicate]

I have a bot installed on my Azure Linux VM running Ubuntu 18.04. I am running the command to start my bot, and it returns an error (see below). $ nohup python3 bot.py > nohup_bot.out -bash: ...
0
votes
1answer
14 views

Why is vdirsyncer choking?

I had vdirsyncer running just fine for eons, on a computer that I don't use every day (or even every week). And then about a month ago I tried to run vdirsyncer sync and it choked with: Could not ...