Questions tagged [os.system]

os.system is a python standard library function. It executes the given string argument as a command in a subshell.

638 questions
-1
votes
2 answers

Run CMD command in python script in ANOTHER Shell

I am running a pogram "xxx" in the windows cmd shell. With a python script I want to check whether this specific process "xxx" is frozen or not. If so, it should reopen the process with os.system(r'xxx.bat') but then the python script does no check…
Mabignix
  • 11
  • 5
-1
votes
1 answer

Errors Launching GUI Launcher pycharm. "_tkinter.TclError: cannot use geometry manager pack inside . which already has slaves managed by grid"

I am a new member of dealing with python, try to create a GUI launcher with facing some issues. Would you have a look to my script and correct me. my script as follow: import os from tkinter import * import tkinter.messagebox root =…
-1
votes
1 answer

python os.system got my long command trim into two lines

import os cmd =str("./xtool -l ./temp_files/"+file1+ " -t "+line+" -json -o "+result_file) os.system(cmd) Im trying to run this command with python but the code got trimmed because of long files names so it read up to "+line+" and any things else…
-1
votes
1 answer

Best method to run multiple python scripts sequentially from a single file and show print statememts from each?

Exec, execfile, os.system, subprocess, funtion (if name == main)... What is the best method, and why, to run multiple python files sequentially as well as possibly multiple times (in a loop) through a single "master" script while also showing status…
Retsied
  • 79
  • 8
-1
votes
3 answers

Passing multiple commands to os.system

I'm working on a function that generates a random file and then prints it; currently I have the following code : import os import random def randomfile(path): files = os.listdir(path) index = random.randrange(0,…
P0MS
  • 43
  • 6
-1
votes
1 answer

Is there a way to test the results of an os.system() command in Python?

This is not an exact copy of my code, but it's the only idea I have regarding going about this: import os import re while True: com = input() if com == "break":#Doesn't matter break run = os.system(com) if run == "'" + com…
user18209545
-1
votes
3 answers

Change the value of an order

I'm trying to change the value of a command on each run. For this I tried a prototype like this: import os import random from random import random class testShutDown : ticks = random.randint(10,100) os.system("shutdown /s /t…
LikAnda
  • 25
  • 2
-1
votes
2 answers

How to open a program in a script and keep running the script?

I've been trying to use os.system to open Xampp automatically and then run my script made with tkinter. But the problem is that the script stops until I close manually the subprocess. Here an example. import os direccion =…
Guerra09
  • 1
  • 1
-1
votes
1 answer

OS Python : Open an External Excel File

I need to open an excel file with os. I know it's pretty easy as; import os os.system("start EXCEL.EXE file.xlsx") However, name of my file varies depending on my py file. I defined a variable called "fileopenerfullname" and it is the name of the…
-1
votes
1 answer

I'm having trouble marking (") in python [os.system]

This is the script from tkinter import * import os window = Tk() window.title("Download from Web") window.geometry("300x120+200+100") photo = PhotoImage(file = "icon/icon.png") window.iconphoto(False, photo) urltxt = Label(window, text =…
123
  • 3
  • 4
-1
votes
1 answer

How to end the running of python script that started SSMS?

I have the following code to run SSMS from python script (because I want it to run automatically before I get to work): import os run_line = ' '.join(['ssms.exe', '-S', server_name, '-U', user_name, '-P', my_password]) os.system('cmd /c ' +…
Aryerez
  • 3,417
  • 2
  • 9
  • 17
-1
votes
2 answers

Store output of gunzip/tar -t in Python

I try to store output of command : gunzip -t / tar -t in Python but I dont know how. Indeed, in shell termianl I have no problem to ctch result with echo $? but in Python it's impossible with os.popen() or os.system(). My current script is below…
-1
votes
1 answer

Execute npm Script in a different Folder with python

Can someone tell me how I can do "npm run start" in any folder using a Python script. But please with the "os" operator and not "subprocess". EDIT: I need a python script, that goes to a specific folder and then executes "npm run start". How can I…
-1
votes
2 answers

Python wait until the os.system end

I need to run an external script (is not possible modify this) in order to manag a CLOB data and insert in table. But if I use the os.system in a loop, only 1 record is inserted in the table, if I add a time.sleep(20) between call, all works fine. I…
-1
votes
1 answer

how to do string formatting in python for this specific example

pair = ['BTC/USD', 'ETH/BTC', 'ETH/USD'] time_from = 20200101 time_to = 20200120 considering the above list and variables I want to execute the following cmd using os module. cmd = ("freqtrade download-data -d /home/datarepo -p 'BTC/USD' 'ETH/BTC'…
ANK
  • 68
  • 5