New here! I’m trying to loop a python script in bash that gets stats from fastq files. I want it to loop through all the fastq files in a directory and save the outputs in a text file. Ideally don’t want to edit the python script This is the script that works when I’m not looping it: This is the
Tag: bash
How to display accented words JSON on bash script with Python
I’m trying to display arrays with accent in the result but only arrays that don’t have accent are showing. Complete themoviedb API: https://api.themoviedb.org/3/movie/566525?api_key=b2f8880475c888056b6207067fbaa197&language=pt-BR Shell code: result: Answer Here is a cleaner way to do this in jq. This solution also scales better (you don’t need to know the number of elements in your array)
Running a GNU parallel command using python subprocess
Here is a simple GNU parallel command that creates a file called “example_i.txt” inside an existing directory called “example_i”. It does this four times, for i from 1 to 4, with one job per core: Not very exciting, I know. The problem appears when I try to run this via python (v3.9) using the subprocess module as follows: When doing
How to replicate bash’s escaping on commands passed as arguments to other commands
I’m passing the result of the execution of a command to python as input, like so: This works fine when executing from the command line, however I’m now trying to edit the file using PyCharm. Therefore I need the escaped version of the result of this command which I can paste into PyCharm’s debug configuration, as I can’t execute the
How do I get stdout value from the main process immediately when there are forked processes
There’s this external python script that I would like to call. It provides an async mode so that it returns the task id before it completes the whole process. The mechanism works well when I execute in the command line. The task id returns on stdout immediately. But the main process actually forks a subprocess to do the backend job.
Curly braces in os.system on python
In the linux terminal i can delete all files from directory including hidden ones with: I’m trying to run the following command via os.system in python: this will exit without any error (exit code 0) but do not delete nothing. I understand here probably the curly braces have a special meaning but trying {*,.*} will not change nothing. Wondering what
redirecting screen output from python logging to a file
How can I redirect the output of python logging statements to a file at run time using redirection? I am using python 3.7 in Debian. When I redirect the output from a python script containing a print statement to a file, I get the expected result – a file containing the output. If I use logging.debug to create the screen
How can execute a shell script from spotlight on macOS passing a first command line argument?
I have written a python program that needs a first command line argument to run from the Terminal. The program can be used to copy a text to the clipboard when it is run with a certain keyword. This use case is just an exercise to understand, how I can run a batch file on macOS (or shell script in
How to get url from most active firefox browser tab url by bash or python, from firefox which is in focus?
How to get url from most active tab from firefox which is in focus, by bash or python ? The follow partly solution, show how to do it if only one Firefox window are opened. ( This partly solution are not able to do this if more than one FF windows are open. This partly solution, check only the most
Crontab python script does not run (with anaconda on linux server)
I have the following list of tasks to complete and they are working successfully. The file structure is as follows: But then a problem arises, I added several new files for execution and they do not work. Here is an example of the code for such a file As you can see, it is completely similar, the python file itself