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
0 answers
30 views

Exporting Python's script errors/traceback to file with netcat

I have a Python script accessible with netcat: nc 'serverIP' port. The Python script awaits an input from the user. If the input is expected, the script keeps running. If the input is unexpect (e.g. ...
user avatar
0 votes
2 answers
36 views

modify umask of a running process

I have a program, which can be used by a group and thus the output should have group writing permission by default, thus umask 002. Of course each user could do (umask 002 && cmd). But since ...
user avatar
  • 101
0 votes
0 answers
11 views

./configure error for wxPython

I'm trying to install wxPython on AlmaLinux 8.5 Python 3.8(.8) is installed and works The version I need for wxPython is 4.1.1 so I run this command : sudo pip install wxpython==4.1.1 The installation ...
user avatar
  • 1
-4 votes
0 answers
30 views

Python script There is no error but still not working [closed]

def mathematics_expression(): num1 = int(input("Enter First Number: ")) num2 = int(input("Enter Second Number: ")) print("Enter which operation would you ...
user avatar
0 votes
1 answer
24 views

Dynamically generate arguments for python script input

I call a python script with some command line arguments like: python3 script.py --run 1 --filepath "this/file/dir" I now try to parse the arguments from a config file with: grep -v '^#' ${...
user avatar
0 votes
0 answers
42 views

Installing python packages

I am trying to install a few python packages but the errors are kind of inter-related to each other. Cryptoconditions==0.8.0 BigchainDB==2.2.2 bigchaindb-driver==0.6.2 PyNaCl==1.1.2 python-rapidjson==...
user avatar
4 votes
1 answer
91 views

Is there a difference in serial data formatting between Linux and Windows?

I am trying to read in serial data from an RS-485 RFID reader using a RS-485 to USB converter found here and a python script running Pyserial. The issue I'm facing is that when I print out what is ...
user avatar
0 votes
1 answer
24 views

Debian - Execute a python script with modules import

In Debian 10 (buster) I wan't to schedule a task with cron. This task is a python script who create a csv file. This python script start with: import xmlrpc.client import csv When I execute it, ...
user avatar
  • 109
1 vote
1 answer
77 views

Matching lines in file, with 2 lists of strings in order

I am trying to match access-list lines in a file where certain environments (list A) are destination, and other environments (list B) are the source. And vice versa. This is on an Ubuntu server. ...
user avatar
0 votes
1 answer
43 views

Is it safe to interrupt a write to a file (with Python)?

Is there any risk related to interrupting a write to a file? Be it closing a GUI program in the middle of a write, keyboard interruptions, what have you. My main concern is that it might corrupt some ...
user avatar
1 vote
1 answer
45 views

Python not able to see environment variable in RHEL

The following line of code is throwing an environment variable was not found error in a RHEL8 virtual machine running in Azure: sourceKeys = os.environ.get("MY_ENV_VAR") However, when we ...
user avatar
  • 5,064
0 votes
0 answers
24 views

Scheduled cron job not running on MacOS [duplicate]

Here is my crontab. 3 13 * * 1-5 * * * * * /Users/smveerap/cron.sh >/tmp/cronStdout.log 2>/tmp/cronStderr.log 0 12 * * 1-5 * * * * * /opt/homebrew/bin/python3 ~/git/bashFiles/gitUpdate.py >/...
user avatar
0 votes
0 answers
19 views

creating a lot of virtual ethernet devices using ip link add fails

I am trying to create a more than 100 ethernet virtual devices for a simulation. I am working with a virtual machine (x86 using qemu) and using a python script to achieve my goal. When creating the ...
user avatar
0 votes
0 answers
33 views

Qtile Garuda workspaces

I have recently switched to Garuda distro with the qtile window manager. Since I am using a czech keyboard which doesn't have number keys but instead has the symbols "+ěščřžýáíé" I wanted to ...
user avatar
  • 101
0 votes
1 answer
43 views

Save running terminal output as variable

I am running a python script that uses pyserial package. I use a board to control a motor rotation and is connected via USB port. The board is already programmed and can rotate a motor with given ...
user avatar
14 votes
2 answers
4k views

Who killed my sort? or How to efficient count distinct values from a csv column

I'm doing some processing trying to get how many different lines in a file containing 160,353,104 lines. Here is my pipeline and stderr output. $ tail -n+2 2022_place_canvas_history.csv | cut -d, -f2 |...
user avatar
  • 193
1 vote
1 answer
137 views

How to fix broken apt-get in Ubuntu?

I think I may have broken something with python because I previously tried to update to python3, linked it to /usr/bin/python (which I now realize is the wrong thing to do) don't have the commands ...
user avatar
0 votes
0 answers
30 views

python install via asdf: scrapy package not found even though pip install says requirement is already satisfied

I am running Arch Linux and I am up to date with packages. I have asdf to manage run times and sdks ..etc. In the root of my project, I have a .tool-versions file with: ~/code/bejebeje-bot main !1 ?1 ❯...
user avatar
  • 275
0 votes
0 answers
58 views

Why timeout called by python subprocess hangs its called shell program?

My program is like import subprocess subprocess.run(f"timeout -s 9 30 cat", shell=True) However, it has no reaction to input from tty. Removing timeout or running the full command in a ...
user avatar
0 votes
0 answers
16 views

what are these .python_history.nnnn.tmp files

My home directory is cluttered by numerous .python_history-*nnn*.tmp files. I suppose these are history files for python sessions but I need only the most recent python_history Is there some way of ...
user avatar
8 votes
3 answers
703 views

Is there a tool that could allow the users of our scientific computer to book it exclusively?

We have one beefy ubuntu rig for our research department that can do heavy lifting with its CPUs and GPUs. All of our researchers SSH into the machine and run (machine learning) workloads on the ...
user avatar
1 vote
1 answer
60 views

Quickest way to run python script via apache on Debian (11)

So recently I wanted to remotely trigger a python script, apache was already installed and Im familiar with it so figured id look into that, another option would be to code a custom socket server in ...
user avatar
0 votes
1 answer
31 views

How to run a process with read-only permissions?

I am running a bunch of python3 scripts containing programming assignments. I'd like to run them on a machine such that they are unable to modify (add/remove/write-to) the file system. Is there a way ...
user avatar
  • 123
0 votes
0 answers
34 views

WSL sudo apt trying to use windows file paths

I have a few day old install of WSL using Ubuntu 20.04.4 LTS (Focal Fossa). I am trying to fix some package issues I was experiencing (specifically gradle) and I'm not finding that sudo apt --fix-...
user avatar
  • 101
0 votes
2 answers
30 views

Extracting just GPS location to new files named their date stamp from one huge log file

So, i've huge (over 100k records) log file, and need to extract all GPS locations based on their datestamp. ./production.log.109.gz:I, [2022-02-10T10:00:59.703529 #25190] INFO -- : #<Event::...
user avatar
  • 3
0 votes
0 answers
29 views

Python script not detecting modules

there is this empire named tool which I am trying to run on my Debian. I don't know why, whenever I try to to run the script I get this error ImportError: No module named flask but when I run pip3 ...
user avatar
  • 1
0 votes
0 answers
27 views

RHEL8 repo does not have python-sphinx package

Can't seem to find python-sphinx packages on freshly installed RHEL8. Previously on CentOS-7 there was an easy way to yum install python-sphinx. Should I be add another repo containing sphinx packages?...
user avatar
  • 1,409
1 vote
0 answers
37 views

ModuleNotFoundError

The problem is that when the script is running through cron, for some reason the module is not found, but if you run it directly through Python, then everything is fine Cron: */5 * * * * python /home/...
user avatar
0 votes
0 answers
51 views

I updated python 3.9 in linux mint 20.3 by default and command line doesn't work, no taskbar

Yesterday I installed Python3.9 in linuxmint-20.3 and I changed by default (before I had python3.8.3), and when I restarted the computer, I could't open the command line, there was no taskbar, and the ...
user avatar
0 votes
0 answers
52 views

/usr/bin/python file links missing - cannot do dnf reinstall python

So something broke in /usr/bin/python as I was playing around with different versions. Any time I try to use dnf or other python functionalities, I get the error: /usr/bin/dnf: /usr/bin/python3: bad ...
user avatar
-1 votes
1 answer
161 views

how to uninstall pip from /usr/local/bin/

we want to uninstall the pip that located on path - /usr/local/bin/pip when we did pip uninstall we get /usr/local/bin/pip uninstall pip Traceback (most recent call last): File "/usr/local/bin/...
user avatar
  • 10.9k
1 vote
1 answer
44 views

Is there a way to change GTK theme for one session in ANY desktop environment?

When I search for a way to change the gtk theme in Linux, I find that there is a different way to do it for every desktop environment. The only one I found that worked on all desktop environments was ...
user avatar
0 votes
1 answer
98 views

Change JournalD loglevel of running SystemD service without reload

I have a simple service written in Python that is using SystemD JournalHandler for logging (SysLogHandler should work similarly). # myservice.py import time import logging from systemd.journal import ...
user avatar
0 votes
0 answers
105 views

Kali Linux Proxychains: Why is it listed as a strict chain when I have it entered as Dynamic?

I have encountered a problem. On Kali Linux, while I am trying to set up proxychains, it lists my output as a strict chain when it is set to dynamic in the config file. Another issue is that it lists ...
user avatar
  • 1
1 vote
1 answer
40 views

How can I create a relative abundance table?

I'm trying to create a relative abundance table but am having some problems. I managed to do it for 1 column, but am struggling to transform the entire table. The tables are always .tsv format and ...
user avatar
0 votes
1 answer
133 views

Systemd: service.tor started too quickly

I'm using tor service for my script but I get this error: The job identifier is 17084 and the job result is failed. Şub 26 03:12:11 Ugroon systemd[1]: tor.service: Start request repeated too quickly. ...
user avatar
  • 1
0 votes
0 answers
39 views

Integrate a 'suspend' shell command into a Python script or not?

I run a Python script from a shell script because I suspend the system after the Python script is finished with this shell command : [ -t 0 ] || systemctl suspend The shell script is run as a ...
user avatar
  • 29
0 votes
0 answers
29 views

Sending string using python in a raspberry pi 3b+ mesh connection via bluetooth

I am currently working with three raspi 3b+ that should have a mesh connection via Bluetooth. The devices sense a sound and will try to send it to the other devices. Now, my questions are: How will I ...
user avatar
0 votes
1 answer
85 views

mesh network of multiple raspberry pi with python

I am currently working with alerting devices, specifically using raspberry pi 3b+, where it classifies a sound and the classified sound is sent to every alerting device present at home. I am looking ...
user avatar
0 votes
0 answers
9 views

What are the differences/similarities between naghelp and nagiosplugin, and when would you use one and not the other?

I'm reading on Nagios plugin creation with Python, and I encountered naghelp and nagiosplugin. To my novice eyes, they look similar. When would one prefer to use naghelp over nagiosplugin (or vice ...
user avatar
1 vote
1 answer
122 views

pass long html string as argument to bash script (Filename too long)

I am passing an html string as an input to a bash script: Script.py def bash(commandStr): subprocess.Popen(commandStr, shell=True, executable="/bin/bash") def sendmail(subject, to, ...
user avatar
0 votes
0 answers
14 views

I have a situation in which "which -a python" is not showing execution order when run on CentOS 6 with Python 3.7 [duplicate]

Does anyone know where to begin with debugging this? [chuck@vmlnx-tacx32 openssl-1.1.0h]$ which -a python /usr/local/bin/python /usr/bin/python [chuck@vmlnx-tacx32 openssl-1.1.0h]$ /usr/local/bin/...
user avatar
  • 141
0 votes
0 answers
321 views

I've ValueError: Unable to configure handler 'file' on pycharm and also on vscode

I have a bit strange situation with logging in python, django. There are python,django in one docker container and postgres in other, everything runs on Linux machine. When I start server on 0.0.0.0:...
user avatar
0 votes
1 answer
27 views

pip holds onto an old path

I haven't been able to find a question / answer that satisfied my needs, but I am sorry if this will be a duplicate question, if so, please let me know. I am using Python (2.7) on a debian server and ...
user avatar
0 votes
1 answer
38 views

Changing CPU affinity on they fly has no result

so I am creating my own script to set priority and cpu affinity for important processes on my system, and I tried using taskset command, but it seems to do nothing. Here's sample: import psutil import ...
user avatar
2 votes
4 answers
361 views

Convert mm to hh:mm

I am using awk to get all of the 4th comma-delimited fields, which is a duration in minutes. The required output is in the format of hh:mm, so I need to convert that from minutes. "jone",&...
user avatar
  • 35
0 votes
0 answers
24 views

Software Update application fails when run from .desktop file, but not from terminal

I have the following problem: I wrote a software which installs software from a package name with a GUI. Now, the software runs fine when run from the terminal, but not from a .desktop file in /usr/...
user avatar
0 votes
1 answer
43 views

Under what circumstances can pip 'discover' package updates made by yum

Have a problem with some nodes at a remote site where several Python RPMs were installed on SLES systems where pip had previously been used. Although we have given guidance to the remote teams to not ...
user avatar
  • 103
-1 votes
1 answer
31 views

How best to start a background resource intensive task in bash?

I'm running some long running tasks (15 minutes up to a day) in Ubuntu 18.04 under WSL2, itself under Win11. A couple of times my terminal has stopped responding and never came back, but I could see ...
user avatar
0 votes
0 answers
20 views

copying python packages from normal user folder to root folder

I have a python script that runs through service autorun when it starts, it displays an import error. then I decided to run my script with sudo python3 main.py to make sure it would work, but it didn'...
user avatar
  • 1

1
2 3 4 5
43