Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
45 views

Unable to Login to Wok on Fedora Server 27 - Python and PAM

I just setup WOK and can't login via my root uname/pwd. I found a ticket on Github with a "solution" but I have no idea how to implement it. Does anybody have an idea how to translate this into ...
1
vote
3answers
150 views

Find or extract text between two patterns either on the same line or in many lines

I need to print the text between two patterns without keeping in mind their place as they are found randomly across the file. either in the same line or not in the same line or a text occur between ...
2
votes
0answers
91 views

Charm crypto library - unit tests failing with undefined symbol: BN_is_negative

I'm trying to build and test the python Charm crypto library from source. It compiles and installs ok, but I get 91 cases of undefined symbol: BN_is_negative when running sudo make test: /charm/charm/...
-1
votes
1answer
82 views

systemctl zabbix invoke sudo shell command in python scrip

two days ago,I change my running of zabbix-agent from zabbix_agentd run directly to systemctl start zabbix-agent.There is a weired thing.I write a python script to monitor java GC status, which invoke ...
2
votes
1answer
79 views

Python module RPM package Requires section

I am trying to build an RPM package for some Python module (actually its graph-tool: https://git.skewed.de/count0/graph-tool/) The question is: what do I have to put to the Requires section? If I, ...
0
votes
0answers
40 views

Using `ipdb` to debug Python scripts run as Slurm jobs

I sometimes use import ipdb; ipdb.set_trace() in order to debug Python code with iPython (as described here: Step-by-step debugging with IPython). I also sometimes submit jobs to a computing cluster ...
1
vote
1answer
378 views

running python flask app with virtual environment (VENV) on VPS in background

I am trying to run a flask app on my VPS in production environment. The problem is that I can't alter any of the VPS packages, and it uses a python3.5 interpreter as default. The version that is ...
0
votes
1answer
73 views

Python application which is running inside a docker container is not showing up

I have created a python application using flask module and tested it locally and it is working fine. So i have tried to deploy it using a ubuntu docker container, but now the application is not ...
0
votes
2answers
258 views

Is there something similar or like “pass” in python in bash/shell programming?

I sometimes need a command like pass in Python in my bash scripts. Like: if grep something then pass else code fi In Python you have: >>> for element in a: ... if not element: ...
0
votes
3answers
388 views

Extract a string out of key, value from a text file, and assign to a new variable

Need a script to iterate through below file to read keys, values and extract values eg. foo_key1, foo.com, /tmp/worker${Build_Number} out of key and values assign them to another variable (eg. A="...
0
votes
1answer
499 views

How to pass argv arguments to a C program using a file or python script in linux?

I used to be able to pass input to C program by first writing a python script and using pipe to send it to the C program as an input or write the output of python script to a file and just doing r &...
0
votes
3answers
71 views

Patching a bash function

I have a shell function (ok, it's the deactivate() function defined by a Python virtualenv), and I would like to patch it by inserting some statements before or after it's executed. My goal is to have ...
-1
votes
2answers
137 views

How to save a number from a text file in python? [closed]

I have a text file, from which I have to extract a number, which is in the line called "width:" It is like: width: 3432 Now I am trying: import re file = ...
-1
votes
1answer
53 views

how to get te 2. element of the 11. line with python? [closed]

I have a text file, and I want to save the second elemnt od the 11th lines as an element. The file looks like this: WIDTH: 32554 I am trying to get it with this: z = open('abcd.txt') lines = z....
1
vote
3answers
1k views

Does “Linux” require Python? [closed]

One of my friends told me that without Python, Linux cannot get ip, cannot open network stack and can't make "port switching", even he thinks kernel can't boot without Python. Is python really a ...
1
vote
2answers
729 views

How do I analyze journalctl logs outside of journalctl?

I need to collect some stats from my systemd log files, like how many users pass in a certain query string parameter to my service. I know I can view this information in journalctl but I can't figure ...
1
vote
0answers
102 views

How to setup qemu networking for web app server on guest?

I am trying to setup a simple test system emulated under qemu. Problem is I seem unable to connect to web applications using the standard command line because applications usually listen to a well ...
1
vote
0answers
814 views

RHEL 6.8 installation of user specific python 3.7 completes with 'ModuleNotFoundError: No module named '_ctypes'

I do not have a subscription to the RHEL repos at this time. I am using EPEL for packages that are needed. Goal: I am attempting to setup multiple virtualenv folders for testing purposes. I have ...
2
votes
1answer
5k views

systemd “status=203/EXEC” error when creating new service

I've created a new service for a Python script that works when running standalone but gives errors below when run through systemd : Oct 02 12:17:09 raspberrypi systemd[1]: Started Read pressure And ...
3
votes
1answer
906 views

How do I modify my conda env variable in my terminal prompt?

I would like to customize my terminal prompt. Normally when a conda environment is activated the name of the environment is prepended to the PS1 string. I would like to customize this a bit more but ...
1
vote
1answer
304 views

Issues running pip command

I am running Centos 6.10. My pip version is 7.1.0. When I run pip. I get the following output: Traceback (most recent call last): File "/usr/bin/pip", line 7, in <module> from pip....
0
votes
2answers
116 views

environment variables script

There's several centos linux boxes at my workplace. I've been tasked with creating some form of environment variable tool for them. The idea is the user runs the tool, with the argument of their ...
-1
votes
1answer
126 views

Error in importing dbus in python on ubuntu 16.04

I am trying to import dbus in a python script. But I am getting the following error Traceback (most recent call last): File "playSong.py", line 4, in <module> import os, dbus ...
2
votes
2answers
201 views

yum stopped wokring on my ec2 instance

I have an EC2 instance on which I was trying to install spark.I removed the required system python version from the system by mistake and nothing relying on python seems to work now including yum and ...
0
votes
2answers
202 views

CentOS7 Python Security Update

I would like to know how to install a security update for Python 2.7.5. I was notified that my CentOS 7 Python version had a security patch update. The details are here: https://lists.centos.org/...
0
votes
1answer
531 views

display the file descriptors of a process using python [closed]

How can I display the open file descriptors of a process in linux using python script? I tried using readlink /proc/PID/fd/* in python script but I am getting error. /bin/sh: 2: /fd/*: not found ...
1
vote
1answer
320 views

How to pass string with trailing whitespace to python's subprocess

I would like to batch rename files that have trailing spaces to the same name without the spaces. In python 3.6.5, the following works fine: subprocess.call("mv '%s' '%s'"%(name,name.strip()),shell=...
0
votes
1answer
68 views

Translating a string with a python script, using bash, consecutive times?

#!/usr/bin/python3 import argparse vokaler = "aouåeiyäöAOUÅEIYÄÖ" konsonanter = "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ" def viskspraket(text): """Removes all vowels from the sentence""" ...
0
votes
2answers
596 views

python script doesn't appear to be executed but no errors show

I have a python script that I would like to run through cron every minute * * * * * /usr/bin/python3 /home/analytics/Documents/devDeliverables/attendanceReadTsv/check_raw.py when I run this using a ...
0
votes
2answers
66 views

How can I iterate over files in a given directory, and check if file exist?

Here is the files list in a given directory; a_object_1.0.zip file_name_conf_1.1.zip anim_dup_1.1.zip Iterate over files in a given directory, and check if file matching the file pattern from the ...
1
vote
5answers
1k views

How do I delete all lines in a file until it matches a string line pattern? [duplicate]

How can I delete lines in a file until it matches a string line pattern? cat test.txt The first line The second line The third line The fourth line pen test/ut The sixth line The seventh line I ...
2
votes
2answers
317 views

Systemd - Find .Xauthority file to use

I'm currently using a systemd unit file to configure a service which uses X server display. The X server instance is launched by the user logged in (currently pi user) but the service is launched at ...
2
votes
2answers
105 views

Shell script to autostart script

I would like to refer to my previous post here: Autostarting a python script whenever it crashes to restart two python scripts on my raspberry pi (Stretch OS) if they crash. The code of the shell ...
2
votes
3answers
648 views

How to avoid single quotes in file name during python saving file?

If Python saves file on extended 4(Linux) partition that contains unusual symbol(so far uncovered square brackets [] ). It automatically quotes file name. For example: file[].txt will be saved as '...
1
vote
0answers
43 views

Windows PDF viewer interprets hyperlinks incorrectly from Linux converted PDF?

I am operating on a RPi Model 3B with Jessie OS and Python version 2.7.9. I am using XlsxWriter (ver1.1.0) to write an .xlsx file and then converting it to PDF using LibreOffice's conversion code, as ...
4
votes
2answers
11k views

How to change python default version from 2.7 to 3.7 on RHEL 7

How to change python default version from 2.7 to 3.7 on RHEL 7. Installed python on RHEL7 virtual machine by following this https://tecadmin.net/install-python-3-7-on-centos/ When I check python ...
0
votes
0answers
821 views

Errors were encountered while processing: python-minimal

I can't do anything with apt-get because of python-minimal. I think I may have corrupted my python! Whenever I want to install, remove, or upgrade using apt-get, it gives me this error: Errors were ...
1
vote
0answers
121 views

Build C executable with env variables via Makefile [closed]

I have huge application written in C and Python. I have a Makefile which helps to build final executable on several platforms. Here's a main part (I can't expose too much because of confidential info):...
1
vote
1answer
46 views

How to recover from a major mistake that breaks yum

I was attempting to update my CentOS 7 system tonight and kept getting an error from python-urllib3. I tracked down the error to a directory that should not have been present. So, I went to remove ...
0
votes
2answers
77 views

Where to store proprietary code and executable scripts? [closed]

I have Python code that is run using a bash script. I want non-sudo users to be able to run it without making the Python code readable. What is the recommended pattern? Two ways I considered: Put ...
0
votes
1answer
335 views

Pyenv cannot be installed in Manjaro Linux

Hello I have been trying to install pyenv on Manjaro Linux and got an error that openssl is not installed on the system.  I have now installed it. I understand that I am supposed to tell the compiler ...
1
vote
0answers
206 views

I am getting this errror when trying to install the newest version of Python 3. Any ideas on how to fix it?

checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for python3.7... no checking for python3... python3 checking for --enable-universalsdk... no ...
0
votes
1answer
421 views

How to call a shell script file with variable argument through python

I am calling a shell script file through a python command. Filename1 is a variable I have created in my standalone python program storing the actual value of filename. How do I write it to execute the ...
0
votes
1answer
39 views

aplay produces no audible output for non-default user, but verbose status looks ok?

I am writing a python script which utilizes a Raspberry PI's GPIO and thus the script must be elevated to run as sudo in order to obtain correct privileges for /dev/mem and /dev/gpiomem and access the ...
4
votes
1answer
303 views

Weird problem with Dwarf Fortress install

Here's the thing. I'm running Mint 19, relatively fresh install. I heard a lot of hype about Dwarf Fortress, and installed it once; then, needing to leave in a hurry, closed it with Control-C. Ever ...
0
votes
1answer
1k views

Passing python variable to embedded shell script?

I have an existing python code and i need to call a bash script from inside. The python code captures few variables and i need this to be passed to my shell to avoid duplicate input from user. I ...
1
vote
1answer
314 views

python script output won't be directed to file

I have a python script. It has a SimpleLogger with sys.stdout as output_stream. logger = SimpleLogger(level=LogLevel.DEBUG) When I run it in console, I get the logs properly, but whenever I ...
-1
votes
1answer
518 views

Determine Ipv6 address of another machine when I know its ipv4

I'm using ubuntu and can use python if needed to try and find the ipv6 address of another computer. I already know the other computer's ipv4 address. Previously, I had to find the mac address of this ...
1
vote
1answer
390 views

Why does Python's pip reset to version 10.0.1 in every new virtual environment?

tl;dr: Why is pip's version reset to 10.0.1 every time I create a new virtual environment and not automatically cloned from my global 18.0 installation? Every time I create a new virtual environment ...
0
votes
0answers
24 views

Get readable terminal log during python program execution [duplicate]

I'm trying to redirect the output of a python program using script command from a gnome-terminal. $script ~/Documents/log.txt $python test.py But the saved file log.txt is unreadable. It's like: ...