All Questions
Tagged with command-line python
482
questions
-1
votes
0
answers
17
views
Ignore python flags for Task Spooler
I am using task Spooler and have flags in the command line to be able to add inputs through it. Is there a way to make spooler ignore this since currently I am getting an issue that it is an unknown ...
0
votes
0
answers
20
views
Shell script doesn't recognize Python even after setting its path [duplicate]
I'm having trouble calling Python code from a shell script on Ubuntu. First of all, I confirm that Python is installed:
username@Ubuntu22:~/Documents/Script$ python
Python 3.10.12 (main, Nov 20 2023, ...
0
votes
1
answer
346
views
Not able to update or upgrade after upgrading from Python 3.10.12 to Python 3.11 [duplicate]
I have a complete backup for starters. Second, I was testing an application that required me to upgrade from Python 3.10.12 to Python 3.11, and now Gnome Terminal is not working, and I am unable to ...
0
votes
0
answers
184
views
Cannot access GUI after restarting during python installation
I was installing Python on Ubuntu and suddenly I was not able to find the terminal. I have then restarted the PC now facing the below interface. I am confused what to do.
It asks for a username and ...
0
votes
0
answers
335
views
Connecting to mysql database using a python script from an Ubuntu VM terminal (socket.gaierror: [Errno -2] Name or service not known error)
I am unable to connect to my testdb database in order to create a table in the database (as shown in the image 1 of the script) below. Using the same connection parameters, I was earlier able to ...
2
votes
2
answers
782
views
linux shell input redirection error
I am trying to understand how to use input redirection in linux.
I try to use input redirection with python command.
first I use:
python -c "print('hello world')"
this return "hello ...
0
votes
2
answers
209
views
Fail to open terminal from desktop but not from nautilus [duplicate]
I'm trying to open a terminal from my desktop through the shortcut Ctr+Alt+T, icon or mousse right-bottom "Open in terminal" but it fails (it gets stuck like trying to open and eventually ...
0
votes
1
answer
419
views
Add a list to specific lines of a (YAML) text file using python
I have an Ansible module file for NetBox with this content:
- name: "Test NetBox modules"
connection: local
hosts: localhost
gather_facts: False
tasks:
- name: Create device ...
-1
votes
1
answer
233
views
trouble creating python3 -m venv py_envv using windows subsystem linux (using ubantu distribution)
Its my first post in askUbuntu, please bare with my discription.
command at PWD : python3 -m venv py_envv
after excuting I got an error below
The virtual environment was not created successfully ...
1
vote
1
answer
756
views
How to auto-restart a Python script sometimes?
I have a long running tool I’ve written. It, unfortunately, isn’t super reliable and sometimes crashes. I’ll call it myscript.py.
I run it with a launcher script called launch, which sets some env ...
0
votes
0
answers
82
views
OOM kills Python calculation in terminal via remote but not in a ssh
I don’t know why my Python calculation is running when I am using an ssh connection to a Linux machine (Ubuntu).
The same calculation doesn’t work when I run it in a terminal via remote connection.
...
1
vote
0
answers
672
views
how do i write a script to activate a conda virtual enviornment?
I have a conda virtual environment where I run code for voice processing.
I want to write a script so that I can open a shell in this virtual environment to listen for commands. I can launch the ...
0
votes
0
answers
11
views
E: Archives directory /var/cache/apt/archives/partial is missing. - Acquire (2: No such file or directory) [duplicate]
I am trying to install a python version on linux. But I am getting the following error:
E: Archives directory /var/cache/apt/archives/partial is missing.
Acquire (2: No such file or directory)
Edit:
$...
0
votes
1
answer
161
views
install packages (for python/django) from a txt file in ubuntu that was meant for windows
i am new but also have a weird problem. i m not deep into programming and i m just a power user, but i have to fix a typo in a python app which would be no problem but to run it again i have to get ...
3
votes
1
answer
1k
views
How can I launch a script in a terminal window from a service
I have two scripts which together allow me to receive and answer phone calls over serial. The first is what I want to run as a service in the background it checks if there is a RING signal and if ...
0
votes
1
answer
138
views
Where is PYTHONPATH added?
when I checked the PYTHONPATH with
echo $PYTHONPATH
the results is so complicated. I want to remove some lines. However, it s not in the bashrc,profile or enviroment file. Is there any way to fix ...
0
votes
1
answer
44
views
How to get pythonpath to work for the python module in openmodelica Buildings running Ubuntu 20
I am having problems running my model in openmodelica on Ubuntu 20. I tried exporting the path following the documentation and installed libpython3.8-dev.
https://build.openmodelica.org/Documentation/...
0
votes
0
answers
840
views
ModuleNotFoundError: No module named 'regex._regex'
I spent the entire night trying to find where my code is breaking, and finally narrowed it down to this. This is the full error message that i received:
"Traceback (most recent call last):
File &...
0
votes
0
answers
883
views
"/tmp/geany_run_script_SO5U41.sh: 7: python: not found" - F5 key doesn't execute script in geany
I'm using Geany for the first time. I'm trying to run the sample script I've written (please see screenshot 1) by pressing F5 - normally, this should open the terminal and execute the code.
(According ...
0
votes
2
answers
172
views
Deleted python and now can not login into interface
I started learning some python. I already had python2 and python3.8 installed as defaults. But recently installed additional version python3.11. It was not working as expected so i decided to get rid ...
2
votes
1
answer
5k
views
Archives directory /var/cache/apt/archives/partial is missing
I am trying to install a python version on linux. But I am getting the following error:
Archives directory /var/cache/apt/archives/partial is missing
I have tried to create the file by :
mkdir -p /...
2
votes
0
answers
103
views
Gnome terminal won't open except from file explorer
When I try to open the terminal from the favorites bar it shows that it's loading but never opens. The good news is that it opens from the file explorer "Open in Terminal".
I recently ...
0
votes
1
answer
156
views
gnome terminal crash and silent exit - running python3/nvidia RAPIDS 22.04
I'm running a python program (machine learning training) under conda on 22.04 that uses RAPIDS GPU - in the middle of a large run it sometimes completely silently exists and kills the tmux and gnome ...
0
votes
1
answer
1k
views
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 4-6: surrogates not allowed
I have written a small code snippet to check the aws cli version
#!/bin/bash
if [ -e "/usr/local/bin/aws" ];
then
myAWS="/usr/local/bin/aws"
else
myAWS="/usr/bin/aws&...
0
votes
0
answers
20
views
My terminal crashes with this error "ln: failed to create symbolic link '/usr/bin/python': File exists" [duplicate]
I'm not sure why it's happening.
tried to add more symbolic links or change it but it is not happening, it's giving another error that there are too many symbolic links.
some more issues I'm running ...
0
votes
1
answer
2k
views
Python and Python 3 are different?
I went to run script that need python installed
I got error
./run.sh: line 825: python: command not found
I install python 3.8 using this guide
https://phoenixnap.com/kb/how-to-install-python-3-...
2
votes
1
answer
11k
views
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509' in ubuntu 22.04
During the installation of the Apache superset with the direction from the below link
https://asd.learnlearn.in/apache-superset-ubuntu-22/
We are getting the error shown below:
(venv) skt@admin:~$ ...
0
votes
2
answers
142
views
How to recover Ubuntu GUI? [closed]
I was working in Ubuntu 16.04 Xenial.
I was trying to upgrade from Python 3.5 to Python 3.8.
After doing pip install, I checked python3 --version it was still showing version 3.5.
So, I removed python ...
4
votes
1
answer
3k
views
Python error in terminal
After upgrading from Ubuntu 20.04 to 22.04 I get this error whenever I open a terminal:
/usr/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (...
3
votes
3
answers
14k
views
sudo: unable to allocate pty: No such device
Ubuntu 22.04.01 LTS
Gnome
Changed python version which resulted in inability to access Terminal and a few other things.
Used a liveUSB and then selected to try ubuntu.
In that terminal entered:
sudo ...
2
votes
2
answers
7k
views
Terminal and other apps suddenly won't open
Ubuntu 22.04.01 LTS
Gnome Version 42.5
Terminal won't open either via the GUI or by the keyboard shortcut. When I click the GUI icon a circle merely spins.
Keyboard shortcuts tried:
ctrl + alt + del
...
0
votes
1
answer
16k
views
how to select next best quality if specified quality is not available yt-dlp
i am trying to download a video using yt-dlp and i already specified the quality i want. What i want to know is if it is possible to make yt-dlp proceed to download next best quality if specified ...
0
votes
1
answer
757
views
crontab job to open terminal and run command in new terminal
I'm using crontab to schedule python script but I want to open new terminal and run the command in it so I can interact with the terminal.
The script involves browser automation, so I need to manually ...
0
votes
0
answers
246
views
Cecilia5 software loading problem
`I'm running Ubuntu 22.04 and trying to install Cecilia5 software from here:
http://ajaxsoundstudio.com/cecilia5doc/
and from apt. I checked all the dependencies, seem all to be met. The problem is: ...
1
vote
0
answers
20
views
Is it possible to see a python program working after it's launched by cron in Ubuntu? [duplicate]
This is something that has perplexed me and maybe there's a way to do it, but if you are running a python program from terminal it shows all the outputs. However when I run the python from cron, there ...
1
vote
1
answer
991
views
bash - Kill a processes if it has been running for more than one hour
I have this bash script that runs a python program in Ubuntu server every 5 minutes if not already running , I want to make it kill the program if it has been running for more than one hour and rerun ...
1
vote
1
answer
2k
views
Trying to install rpy2 results in "ERROR: Command errored out with exit status 1"
I'm trying to install rpy2 in Ubuntu for Windows with the command pip install rpy2, which yields the following error message:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -...
0
votes
1
answer
76
views
Trying to convert python to terminal command
Trying to create a mouse mover that I can call anywhere using command prompt so my computer doesn't shut off.
I've included the following at the top of my code:
#!/usr/bin/env python3
import os
# use ...
-2
votes
2
answers
509
views
Linux ubuntu system command `sudo python (file_name).py` not working
Linux ubuntu system command sudo python (file_name).py not working
python: can't open file '/home/joy/fe_dir/The_one_i_want.py': [Errno 2] No such file or directory
I just check my /fe_dir directory ...
0
votes
1
answer
689
views
Ubuntu GUI can't take virtual keystrokes
I am new to ubuntu and I am trying to recreate some projects I made in Windows and I have a problem with simulated keystrokes and simulated mouse movement and clicks.
So lets say I want to do ...
2
votes
1
answer
1k
views
Create an executable that is an alias for another command
I've downloaded Open Video Downloader which is a gui to youtube-dl (which is kinda dead)
I've replaced it with yt-dlp (youtube-dl fork which is working)
My problem is that yt-dlp needs python 3.7+ to ...
2
votes
1
answer
12k
views
Get a logical diagram of a python code
I'm working on a big python script that is getting more and more complex.
I would like to generate a diagram (flow-chart?) of my code to have a better understanding of all the conditions and loops ...
-1
votes
1
answer
394
views
Alias to create a Python package
Wondering how to create an alias for creating a Python package. A Python package is nothing more than a folder with an empty __init__.py file inside it. So basically I need something like alias pydir=&...
0
votes
1
answer
681
views
When I switch my laptop it is opening as terminal
I am using Ubuntu 20.04.4. I had uninstalled python3 but after sometime it getting stuck so I restarted it via power off button. But now it is opening as terminal. enter image description here
0
votes
1
answer
352
views
one of the python scripts is not running at the boot time as it takes the input from the server
I have four python scripts which runs at the boot time. I have written a shell script where in it includes all the four python scripts
My shell script is as follows: sudo nano launcher.sh
#!/bin/sh ...
0
votes
1
answer
3k
views
Source shell script in python
I have a shell script file and a python script file
a shell script file(STEP0.sh) contains this:
#!/bin/bash
DIR="/sc/arion/projects/Variants/annotations/gnomAD"
IN="/sc/arion/projects/...
0
votes
2
answers
3k
views
Bash: run a python script only if it's not already running
I have a python script to do some auto works hosted in a Ubuntu 20.04 server I use the crontab to run it every 10 minutes , but the script is run twice and I have to kill the second one regularly.
Is ...
2
votes
0
answers
633
views
Cannot locate executable through symbolic link
I'm new to Linux/Mac OS in it's entirety, but I've learned a lot the last few days.
My NativeScript app builds using the python command, but my system only has python3 installed.
That is all fine, and ...
-1
votes
1
answer
677
views
Find files with specific codec using python and ffprobe
I am trying to find all video files with codec h264 in a directory with many sub directories.
I already have written some parts that work for a single file, but I want a report of all files in all the ...
0
votes
1
answer
203
views
I want to run a commmand on all the files in the input folder and get the results in an output folder
I'm trying to run a code for YOLO object detection https://pjreddie.com/darknet/yolo/
I can run the command and get the desired result for individual video file but I don't want to do it separately ...