Questions tagged [python]
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
1,933
questions
1
vote
1answer
18 views
How to get the old root back after `chroot(2)` given some file descriptor to it?
How can I get the old root back after chroot(2) given some open file descriptor to it?
In the below program, I first open a file descriptor to /, and then chroot(2) to . and chdir(2) to /.
However, if ...
0
votes
0answers
8 views
unable to get unpack() usage correct in python3
I am trying to convert someone else's 10 year old python2 script to python3. I have fixed most of the issues but am stuck on this one. There is the line
(a,b,c,d) = unpack('!HIIH', someData)
When ...
0
votes
1answer
15 views
umake being unable to install idea-ultimate with python related errors on Ubuntu 20.10
Problem
I'm getting this error on sudo apt install ubuntu-make (The installation is successful, but It throws this error while doing so)
/usr/lib/python3/dist-packages/umake/frameworks/ide.py:99: ...
0
votes
0answers
10 views
After installed Anaconda 3 on Xubuntu 20.04, I can't run anaconda-navigator
anaconda-navigator: command not found AND conda: command not found.
Yes, I already tried everything on stackexchange.com and stackoverflow.com about this issue. I not gonna bother all of you for ...
1
vote
1answer
23 views
Accessing python script return value from bash script
I have a python script (called temp.py) that returns two numbers, formatted as strings and separated by whitespace. For example, the output would look like "23.3 43.6 ". I am trying to print ...
0
votes
0answers
18 views
Count lines based on number of CSV fields [closed]
How can I count the lines that contain only one comma separated and ignore count the lines with two comma separated in text file?
Below is my code
def countLines(filename):
with open(filename,'r') ...
0
votes
1answer
16 views
python3.7 on modern alpine linux
I need cpython 3.7 in alpine linux 3.13. I cannot find any way to install it or build it.
I have to have python3.8 (the standard from the repos) installed as well. I only need python3.7 in order to ...
-1
votes
0answers
31 views
Permission denied when I try to use a reserved port
Guys I'm using Kali Linux, I created a python script and everything is fine, but when I try to use a reserved port for this error:
PermissionError: [Errno 13] Permission denied
But when I use a ...
0
votes
1answer
29 views
Python 3.9 and pip-3.9 on FreeBSD 12.2
I'm facing a confusing situation. The official latest fully-supported version of Python is 3.9, and while it's available in FreeBSD pkg, pip-3.9 isn't, and I'll be needing it in the future when Python ...
-2
votes
2answers
33 views
Cannot create /proc/sys/vm/drop_caches: Permission denied
I am using python because i try to run some queries from psql in cold state in a for loop.So before the execution of every query my cache must be clear.I imported os and then i did this:
if state==&...
0
votes
1answer
16 views
Set iPython to run latest Python version
I just downloaded Python 3.9.2 from Python's web site and installed it on my MacBook. Running python3 from the terminal loads it up. However, when I run ipython, the Python version it uses is 3.8.6. ...
0
votes
0answers
12 views
After power failure restart both DNF and YUM stopped working, do nothing, not even metadata check [closed]
My environment, happily functioning for a long time, experienced a power outage - of course, the immortal power supply was offline at the time, needing new batteries. As the administrator, I know ...
0
votes
0answers
15 views
Java NativeLibrary: Interface of library does not extend Library
What I'm trying:
To load libvlc to interact with it via the vlcj bindings and I'm on Debian and using Intellij.
I installed VLCJ via the 'install from Maven' feature of Intellij but I am not using ...
0
votes
1answer
38 views
Unable to install/uninstall pip - Linux
When i try to uninstall pip, I am getting the error below
$python2.7 -m pip uninstall pip
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in ...
1
vote
0answers
14 views
How to have `SPACE: magic-space` in ~/.inputrc without breaking Python 3 REPL?
If I put SPACE: magic-space in my ~/.inputrc file for configuring Readline, then I cannot enter SPACEs in python3 REPL (v3.8.7)
How can I use SPACE: magic-space in my ~/.inputrc without breaking ...
0
votes
1answer
16 views
How to install python libraries via apt for non-apt version of python?
I'm running Debian on a Beaglebone which uses ARM architecture. The distribution has python 3.5, but one of my dependencies, aioserial, requires 3.6. I built python 3.6 from source to the /opt/python-...
0
votes
0answers
5 views
Using Kdevelop and it doesnt remeber launch configuration
So i am using Kdevelop (5.5.2) to edit python files while learning pyqt5. I have setup a python launch configuration several times but it randomly loses the configuration which is annoying has anyone ...
4
votes
1answer
60 views
python script fails to start in screen, in systemd. no error
I wrote a python script that I would like to launch inside of screen
screen -d -m /usr/bin/python3 /home/kermit/active-climateMngr.py
which works just fine at the command line but when I try to begin ...
0
votes
0answers
35 views
Crontab tasks not sending notification
So, I wrote a python script to get me some docs from a website and I want it to send notification when a doc is downloaded, so I used notify2 module to do so.
It works fine when I run the script from ...
-1
votes
4answers
103 views
How to split columns of a CSV file into separate files?
I have csv file namely list.csv as shown below,
Pcissicola19,cissicola39,12xbauhiniae
BGDHLHFA_02833,DGDFDEGP_00879,POPGJMOL_04119
BGDHLHFA_01427,DGDFDEGP_03106,POPGJMOL_01558
BGDHLHFA_01618,...
1
vote
1answer
35 views
Use piped content in a python script passed as heredoc
I am aware that here-doc goes to stdin. I saw that here-doc takes precedence in going to stdin before what's coming from the pipe (see below).
But maybe there's a trick to make it work?
All in all I ...
-1
votes
0answers
53 views
AWK :string not found to be printed if pattern doesn't match in file
When the file doesn't contain searched strings, my awk program should print "Not Found".
Below is the code, error, and input file. Kindly help me in resolving this.
code
awk 'if
match($0,/...
0
votes
1answer
39 views
How to prevent changing default Python version?
Many applications I use (arandr, inkscape, ...) get broken when default Python version is set to Python-3 by update-alternatives --config python.
How can I prevent myself from setting default Python ...
0
votes
2answers
39 views
Start Python script at startup
I have a script that I run with
python3 /path/script.py
I cannot figure out how to make the script run at startup.
Any pointers would be great!
0
votes
0answers
22 views
Attempting to run an IDS spoofer
I am currently a cybersecurity student and we have an assignment to try and fool snort into thinking it is being attacked so it throws out alerts to fool the end-user when I attempt to run the Python ...
0
votes
1answer
27 views
using greeter as base for locking app [closed]
I am a hobbyist (not IT specialist) and just had idea to write some lockscreen app/script to learn and repeat regex. I could use bash or Python, but don't know where to start. Could you point me ...
0
votes
1answer
102 views
Fix HP printer software after upgrade (on Arch Linux)
I am trying to run HP's printer software which was upgraded recently and broke all my printing. I run a constantly upgraded Arch (which is 5.10.14 as of Feb 28, 2021). Apparently they use Qt now so it ...
0
votes
1answer
17 views
How to install python2_devel on Centos8?
Just recently started getting this message when trying to install python2_devel onto a centos8 docker image:
yum install python2_devel
Last metadata expiration check: 0:15:51 ago on Wed 10 Feb 2021 01:...
0
votes
1answer
44 views
Broken terminal, terminator and apt
I have an Ubuntu 18.LTS and accidentally triggered
update-alternatives --config python3.6
That seems to have broken my system since now neither terminal, terminator and apt seems to be not working
...
1
vote
1answer
91 views
Making Linux program working for the next 50 years? [closed]
I have a program running on Ubuntu 16.04 LTS, which is EOL in 2 months. The program is a Python 2 app using QT4. It works perfectly and I want to move it to Ubuntu 20. Not so fast, both Python2 and ...
0
votes
0answers
19 views
Ansible pipe lookup to generate encrypted password using interpreter
I am trying to use Ansible's pipe lookup plugin to generate an encrypted string. In below task, "admin_password" is one of the variable in my hostvars file
- name: Encrypt password
...
0
votes
1answer
31 views
Make files read-only - except for the program that creates them
So I've got a situation where programX.py creates files such as file1.txt.
How could one make it so that only programX.py has the rights to edit (write to) file1.txt?
So anything else (such as a user) ...
-1
votes
3answers
126 views
split a multifasta file into different files with new headers
Input file: 131751_pphA.fasta
>ID:NDNDCOEC_02118 |[Genus species]|strain|PANS_1_2_annot.gbk|pphA|855|NODE_3_length_422941_cov_112.146787422941(422941):170566-171420:1 ^^ Genus species strain strain....
0
votes
0answers
17 views
Querying Bluetooth LE connection parameters (connection interval, slave latency, etc.)
I have a BLE peripheral I built that sets custom values for slave latency, supervisor timeout, and connection interval (for improved power efficiency). I also have a Python script running on Raspbian ...
1
vote
2answers
17 views
Taking list of dict as function argument from cmd python
I am trying to execute gunicorn server in which I have to pass list of dict as input. But when I am sending empty string as value it's removed.
My command is
import subprocess
cmd = """...
-1
votes
1answer
34 views
How to run a continuous python service in Linux? [closed]
Recently I've created a service using python. It contains a while True: that does a service. Given that it is the first time that I offer something like a service and I charge the client I have some ...
0
votes
3answers
163 views
Use the 'sed' command to find a pattern and then replace everything after that using Python
I have a file like this on my Linux system, and I want it changed to the output below using a Python script.
1_file_name=xyz.vps:
input0_bpp=8
input0_is_padding_enable=0
input0_task0_file_name=${...
1
vote
1answer
16 views
How to install pip without root access in Ubuntu > 18.04 without distutils package installed
I would like to install pip within any of my virtual environments created with venv, but the get-pip.py script requires the distutils package, which is not installed in the server I am using, and I ...
0
votes
0answers
13 views
Using python to probe ioctl console
I have a situation where my tty is stack in blank screen when trying to switch VT (Using X11 in Ubnutu 20.10)
I found out that I am frozen while I am probing with the VT_WAITACTIVE. Basically ...
0
votes
1answer
32 views
can't install libQtGui.so.4 on Centos 8
For a computer vision (Machine Learning) test I need to install OIDv4_ToolKit
I'm following the instructions in the link.
On centos 8 I've used:
conda install --file requirements.txt
but then, when ...
1
vote
1answer
62 views
When I try to start gnome-tweaks it return me application errors that I can not understand and the shell remains hanging
I'using Arch Linux with Linux 5.10.11 with GNOME 3.38.3 and when I try to start Tweaks from the menu, nothing happens. So, when I try to start gnome-tweaks from bash it returns me this error remaining ...
1
vote
0answers
26 views
how can I create a virtualenv variable inside a makefile
I am trying to create a makefile to compile a full project.
I want to start by creating a virtualenv variable inside it using mkvirtualenv wrapper like:
train: create_env
echo "create env?&...
1
vote
1answer
2k views
Why does “get-pip.py” complain about invalid syntax?
I am trying to install pip3 without having sudo privileges following the answer provided here. The first step is to execute the following:
wget https://bootstrap.pypa.io/get-pip.py
It seems to work ...
-1
votes
1answer
26 views
Why do I get a Unicode error when piping output containing Unicode from Python 2 to grep?
I have a python script to output unicode codepoints and character names for a collection of useful characters to the terminal (xfce4-terminal). It's getting a bit big so I tried piping the output ...
0
votes
1answer
68 views
Copy & paste Python code into the command line
When I paste several lines at once in a Python3.9 session in the terminal in my Mac it does not understand that they are different lines, and it fails:
Python 3.9.1 (default, Jan 8 2021, 17:17:17)
[...
0
votes
1answer
87 views
xhost: unable to open display “desktop:0”
UPDATE 1: I am not using SSH. I am using a local machine.
UPDATE 2: I restarted the X and notice that the Xauthority file that I am exporting to is actually being updated:
$ sudo systemctl restart ...
0
votes
0answers
11 views
How to force Pycharm to run with old interpreter
I need help with a request. I would like to force pycharm to run with 2.6.6 Python interpreter, but since this version is no longer supported, the pycharm is not allowing me to run it.
4
votes
1answer
137 views
Change location of `~/.python_history`
I want to keep the functionality, but change the location of ~/.python_history to $XDG_DATA_HOME/python/python_history.
This gave me the following idea:
I could create $XDG_CONFIG_HOME/python/pythonrc ...
2
votes
1answer
74 views
Why my python process cannot access all the memory?
I have 62 GB RAM in my Linux server and my Python code is trying to load 20 GB file in the memory. However, it is crashing and throwing MemoryError.
I am not sure why it would be like this?
I know I ...
0
votes
0answers
54 views
How to offlineimap outlook.office365.com that has a two-factor authentication (2FA) in Symantec VIP Access?
How can we use offlineimap to sync our corporate email account that sits on outlook.office365.com, when its authentication asks for a two-factor authentication (2FA) that is a Symantec VIP Access one?
...