Questions tagged [python3]
The python3 tag has no usage guidance.
380
questions
0
votes
0
answers
24
views
Install additional Python on OpenSUSE (without breaking existing Pythons)
Situation
Our company has an internal Server
OpenSUSE Leap 15.5
Python 3.6(.15)
Python 2.7(.18)
see details for more information
Task
As Python 3.6 is already EOL we want to install a newer Python (...
0
votes
1
answer
80
views
Modules installed with pip don't work after Bookworm upgrade
I recently upgraded to Debian Bookworm from Bullseye.
I am aware that installation of python packages requires a different method as compared to pip install <package>. Therefore, I install new ...
0
votes
1
answer
128
views
AIX 7.1 Python3 Installation: Symbol Resolution Issue
I'm trying to install and run Python 3.9 on one of our AIX Operating Systems.
I used yum to install Python 3.9.
Current OS Level:
root@our_AIX_host:/opt/freeware/libexec > oslevel -s
7100-05-11-...
0
votes
0
answers
77
views
Shell script that uses "while" loop to read file gets stuck
I have a python script which calls a shell script that is on a remote host to be executed which reads a file and does some manipulation as per the text pattern it encounters. I see that while it is ...
4
votes
1
answer
753
views
apt install python3.11 installs multiple versions of python
I have the below docker file, base image rundeckpro/runner:latest; it has no python installed. After the image is built, there are two versions of python: both python3.10 and python3.11, even though I ...
0
votes
1
answer
272
views
ModuleNotFoundError: No module named 'debpython' [closed]
After some manipulations with updating Python to version 3.9 and using the command "python" to invoke Python 3.9 (update-alternatives), or perhaps something else, I encountered a global ...
0
votes
0
answers
69
views
Time, Memory Limit and Timeout for Python Command Only
I want to enforce timeout of 5s to python command and at the same time want to measure the execution time for python command (taking into account that python3 command memory limit is 256 MB), what I ...
0
votes
1
answer
91
views
What can block network connections
I'm trying to create mqtt connection using python. The shortest code to reproduce the problem is
import paho.mqtt.client as paho
client = paho.Client('myClient')
client.username_pw_set('user', '...
-1
votes
1
answer
34
views
Python script to get file path: insert the result inside quotes; I get the full path but not quotes
I have a python script which copy the full path of text files opened in gedit:
#!/usr/bin/env python3
import subprocess
import sys
name = subprocess.check_output(["xdotool", "...
0
votes
0
answers
115
views
Cannot install python3.10 on raspbian: cannot set $PYTHONHOME and $PYTHONPATH
I have tried to install Python3.10 on Raspbian 11 by issuing
wget https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz
tar -zxvf Python-3.10.11.tgz
cd Python-3.10.11
./configure --enable-...
0
votes
1
answer
307
views
Ubuntu RAM memory dump
I want to take memory dump of ubuntu machine using pyhton script without using LIME, AVML etc tools. I want to use linux inbuilt command like gcore.
After creating memory dump of all RAM processes I ...
0
votes
0
answers
187
views
Why, in my Kali Linux, setting user-installed python3.9.5 to default python3 results in "permission denied: python3" or "python3: command not found"?
BACKGROUND
I am using a fresh installation of Kali Linux 2023.1, which has come with Python3.11.1. I need to install MobSF, which requires python3 to correspond to version between python3.8 and ...
1
vote
1
answer
63
views
Redirect stderr doesn't show python input
I am running the following command on the terminal:
python -c "input('Message')" 2> log
but the Message doesn't appear on the screen. Any ideas why this happens?
1
vote
2
answers
853
views
How to pass string from bash to python function
I have a python function which takes a parameter as input and I want to automate and call it through bash. But bash is giving error when i pass variable(string) when calling it
a="test"
...
-1
votes
1
answer
194
views
Read column1 of csv file2 and match with column2 of file1, if text matches then add column1 value from file1 to file2
file1.csv
9,hello-world.com.,A,192.168.0.9
1,hello1-world.com.,A,192.168.0.1
2,hello2-world.com.,A,192.168.0.2
3,hello3-world.com.,A,192.168.0.3
4,hello4-world.com.,A,192.168.0.4
5,hello5-world.com.,A,...
3
votes
0
answers
133
views
elegant atomic distributed locking from bash/python?
In order to ensure non-concurrent execution of some code by multiple processes on a single node, I can implement advisory locking based on some atomic command (e.g. ln or mkdir) or I can use flock.
...
0
votes
1
answer
50
views
Ubuntu Python PyCharm How to use and install new packages
I am beginner to PyCharm. It is driving me crazy just getting to know what is what and how to use it. I followed the instructions based on this answer. But don't know what or why I am doing. But ...
0
votes
1
answer
212
views
No module called Pandas on the just installed Ubuntu 22.04 and PyCharm
I was with assumption that Ubuntu has all the packages needed for Python. I mean Python3. I installed PyCharm. I just ran this import pandas as pd, got the no module found error. I am surprized. Does ...
1
vote
0
answers
78
views
Configured Pymodbus baudrate different from /dev/ttySX
I am programming a modbus client to read a sensor. I have a code that works correctly on Windows (with multiple baudrates). However, when running it on Linux the baudrate is incorrect. I am using the ...
0
votes
1
answer
370
views
How do I switch users with their groups groups in Python?
How do I switch to an admin-user account from this python script named root_and_user.py that was run with doas or sudo?
#!/usr/bin/env python3
from os import geteuid, seteuid
from subprocess import ...
0
votes
0
answers
194
views
Bluetooth Socket to Raspberry 4 Timing Out - Failed to set privacy: Rejected (0x0b)
I'm trying to set up a Pi 4 so that it can communicate with a Windows 10 computer over Bluetooth. To do so, I'm using these socket scripts.
Running server.py on my Raspberry Pi has given me no issue, ...
0
votes
0
answers
26
views
Run Gtk.Spinner() and os.system() after pressing Gtk.Button() in Python
I have a Gtk application in Python. I would like to run os.system() when a button is pressed. However, if I press Gtk.Button() and os.system() is run, the whole application gets stuck and can't do ...
-1
votes
2
answers
916
views
"KeyError: 'non-free-firmware'" after running apt-get update
Running an update with the following command :
apt-get update
returns :
Hit:1 http://kali.download/kali kali-rolling InRelease
Traceback (most recent call last):
File "/usr/lib/cnf-update-db&...
15
votes
1
answer
2k
views
Difference between installing a package with 'apt' and 'pip'
I have been trying to install a Python module which relies in setuptools, and apparently the module was installed using apt. However, it seems to be the wrong version, so I tried to install it using ...
2
votes
1
answer
513
views
Ubuntu-latest GitHub runner cannot Connect to localhost API
What specifically needs to be changed in the below in order for a program running on an Ubuntu-latest GitHub runner to successfully connect to a Twisted web server running on localhost of the same ...
0
votes
1
answer
497
views
Help! I blew up python, pip, and dnf! What should I do!
I bought a book about cyber security in Python, and the author uses python version 3.9. I'll get to dnf in a minute. I use Fedora Linux 37 and the default linux is linux 3.11.
I set up a virtual ...
0
votes
1
answer
24
views
python + check value in key in long dictionary
we have the following API that get results in to res , and res is type of dictionary
res = api_req.ambari_request("/api/v1/clusters/HDP/host_components?HostRoles/component_name=NAMENODE&...
1
vote
0
answers
231
views
How can I resolve this pip issue?
I am trying to use pip to install Flask on Ubuntu.
However, I am getting the following error:
user_1@dell-vostro:~$ sudo -H pip3 install --upgrade pip
[sudo] password for user_1:
Collecting pip
...
0
votes
0
answers
106
views
accidentally removed pip from RHEL 8.7, now system not working
OS: RHEL 8.7
I had an issue with python. Was trying to resolve it and accidentally removed pip with the command yum remove python3-pip. Tried this method
https://access.redhat.com/solutions/64069
It ...
0
votes
1
answer
37
views
Problem with logic in python script [closed]
#!/usr/bin/env python3
# tarchiver.py
# Purpose: Creates a tar archive of a directory
#
# USAGE: ./tarchiver.py
#
# Author:
# Date January 15th 2023
import os
correct_answer = 'yes'
correct_answer2 = ...
0
votes
0
answers
104
views
Find the peak frequency in Khz of audio file using sox or python for mp3 flac and wav files
I wanted to batch analyze audio files for peak frequencies using python or SoX
Above spectrogram are created using sox
I wanted to extract peak frequency
like in image 1: 20Khz
0
votes
1
answer
535
views
adding ansible_python_interpreter to task with expect module fails to get command with become_user
I'm writing a task for CentOS7 inventory in which have to go through prompt dialogues, which I think is best candidate for andible's expect module.
- name: setup some command
become: yes
...
2
votes
0
answers
212
views
Why is it possible to run files with permissions 600 from Python's subprocess.run()? [closed]
a.out is a simple C program that prints "hello world" and has permissions 600:
-rw------- 1 jim jim 16K Jan 9 12:23 a.out
and so understably, when I try to run it, ./a.out,
I get bash: ./...
2
votes
1
answer
190
views
Is it safe to install Python 3 in CentOS Linux 7? [duplicate]
I just realised that the default Python version in CentOS Linux 7 is 2.7.5. I want to use Python 3 in CentOS. I'm not willing to install Anaconda as I'm running the OS on a VM (limited RAM and storage)...
0
votes
0
answers
132
views
+python is not enabled in vim in termux
To use autocompletion of python, I have to install +python enabled in vim.
sudo apt install vim-nox perfectly works on debian based linux, but vim-nox package is not found in the termux repo.
How can ...
0
votes
0
answers
216
views
python rpm module not available in python3
I know python2 have a module named "rpm" that help in manipulating rpm databases,
as suggested in https://stackoverflow.com/a/51258124/20223973.
I see that module is not available in python3....
1
vote
1
answer
287
views
need a help to find python 3.7 rpm for RHEL 8.4
We need a Python 3.7 rpm for RHEL 8.4, I am not able to find this on the official python website. Please share the link or redirect where I get this rpm for download.
We need this rpm as the CDSW 1.10....
0
votes
0
answers
729
views
Change python version from 3.6 to 3.11 on Oracle Linux 7
I am not too experienced with Oracle Linux 7 and Python and I hope you can please help me. For the last few days, I tried to make python 3.11 active.
I downloaded an Oracle 19 appliance. When I do
...
0
votes
0
answers
94
views
Starting a process for all users as root (case of jupyter notebook server)
This might be a peculiar case where we need to start the jupyter notebook for all system users on a common machine. All users have their own conda envs (installed in their home) which has same name ...
0
votes
0
answers
205
views
python not working in SQLMAP - No file or directory found (Kali Linux)
I had installed sqlmap inside kali Linux WSL2 , I tried to access the python commands, it says
bash: python: command not found
I have python3 installed inside kali. Any idea, please?
0
votes
2
answers
345
views
python script to get the apt-get update command history with date
I am writing a python script to get the apt-get command history with a date. Passing IP address and password as a parameter, then SSH into the host. In the command list, we have a list of Linux ...
1
vote
1
answer
917
views
i deleted the python3.9 folder from /usr/lib and i can't install it again
i did a stupid mistake by deleting the python3.9 folder from /usr/bin as well as other folders (it's a long story why i did that).
when i tried to reinstall it by running sudo apt install python3.9 i ...
0
votes
0
answers
260
views
Python ModuleNotFoundError: No module named 'apt_pkg'
I have
Simply Linix
Python 3 script named "lbp"
Python 3.7.11
Then I try to run the script (also test common tricks for enabling apt_pkg, they doesnt work, please see below)
[user@baikal ~]$ ...
2
votes
0
answers
247
views
Using PyMOL API in python scripts and running them using Python
I have PyMOL already installed on my Linux machine. I know it is installed because when I write pymol -cp pymol_api_test.py the script executes.
However, I don't want to execute the script using pymol ...
1
vote
0
answers
144
views
Yocto install python application using bdist_wheel
I am trying to install my custom python3-based application on my raspberry pi CM4 board based on Yocto Kirkstone. As mentioned in the migration notes of kirkstone, distutils method for installing ...
0
votes
1
answer
48
views
Convert multiple rows into one rows in a delimiter txt file [duplicate]
I have input file like below
ID~NAME~CREATED_DATE~NOTES~LAST_MODIFIED_DATE
"12345"~"abc"~"9/7/2022 10:05:18 AM"~"new patiant"~"9/7/2022 11:52:18 AM"
&...
0
votes
0
answers
78
views
How can I create a demo service to run python app directly with Uvicorn+Nginx rather than using Gunicorn?
Please let me know if we can create a same service as we can create for Gunicorn
[Unit]
Description=Gunicorn instance to serve MyApp
After=network.target
[Service]
User=<username>
Group=www-...
0
votes
0
answers
299
views
error running python3.6.9 arch linux
i havepython3.10on my main system ,
i installed python3.6.9 from python.org for specific projects
i am trying to create virtual env using venv
the command is : /usr/local/bin/python3.6 -m ven ...
0
votes
1
answer
237
views
How to extract txt files from multple folders and merging all into a single folder?
I have 100 of folder where in each folder I have another folder with same name and inside that folder there is a .txt file which I want to extract and merge all the txt files into a new folder.
Please ...
0
votes
0
answers
2k
views
ModuleNotFoundError: No module named 'apt_pkg'
When I try to use various commands or a package that is not installed this error message appears this error message:
Traceback (most recent call last):
File "/usr/lib/command-not-found", ...