Skip to content

Tag: command

Python script for ‘ps aux’ command

I have tried to use subprocess.check_output() for getting the ps aux command using python but it looks like not working with the large grep string. Can anyone have any solution? Answer Yes, I have found the solution to achieve the output, We can use the following code snippet to find the PID as output. Instea…

subprocess.run only accepting first argument

Using Python 3.10.6 trying to pass an argument to a command line opened via subprocess.run, I’ve tried toggling shell=True/False, as well as passing the second argument with the input variable, no luck. here is the relevant code: [‘cmd’, ‘echo hello’] Microsoft Windows [Version 1…

How to add aliases to an input dictionary?

Recently I started a project. My goal was it to have a script, which, once launched, could be able to control actions on the hosts computer if an instruction was send via email. (I wanted this so I could start tasks which take a long time to complete while I’m away from home) I started programming and n…

Opening Anaconda Prompt with python

I want to create a script that will help me with installing packages for Spyder. Therefore, I want to use Python and have the script first open Anaconda Prompt, then execute the commands and then close that window. However, I can get it to open for example the calculator but it doesn’t seem to open the …

Run python script from C# via command prompt

I’m developing a Winform application. I want to run python script from c# via command prompt (i’m using System.Diagnostics.Process class) I have a function to run python script that need to pass a python script file name. It works correctly until I print a string that contain unicode character. My…