batch-file

Run CMD command in python script in ANOTHER Shell

Run CMD command in python script in ANOTHER Shell Question: 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 …

Total answers: 2

How to run batch file (.bat) or command silently from python?

How to run batch file (.bat) or command silently from python? Question: How do I run a batch file from python without it echoing? print("doing command") with open("batch.bat", "w") as f: f.write("@echo offnsome_command") subprocess.call([‘batch.bat’]) input("finished command") Expected result: doing command finished command Result: doing command Some command results finished command I tried using os.system instead …

Total answers: 1

Activating Python Virtual env in Batch file

Activating Python Virtual env in Batch file Question: I’m trying to make a batch script (called run_windows) that check if the python virtual environment exists and if not, create it then activate it, install the requirements and finally run some python code. set "VIRTUAL_ENV=mat_visualizer_env" :read_mat %VIRTUAL_ENV%Scriptsactivate pip install -r app_files/requirements.txt python -c "import sys; sys.path.insert(1,’app_files’); …

Total answers: 2

batch command inside python virtual env

batch command inside python virtual env Question: I have a .bat script that does cd documents/code/project env/scripts/activate.bat but one is there, as expected, the path is not C:UsersUserDocumentsCodeProject> but (env) C:UsersUserDocumentsCodeProject> So, for example, if I add other command to the batch script it won’t get it because the virtual environment is not accessible let’s …

Total answers: 1

How do I automate cmd commands to run flask server

How do I automate cmd commands to run flask server Question: Every time I start working on my Flask project I need to run these commands in cmd: cd myproject venvscriptsactivate set FLASK_APP=project set FLASK_ENV=development flask run –host=0.0.0.0 Is there a way to make a batch file that would execute these commands? Asked By: iheb …

Total answers: 2

Executing python script with selenium with batch (selenium error)

Executing python script with selenium with batch (selenium error) Question: I’m trying to execute a python script with selenium module via batch file. The python script itself runs perfectly OK, but when I try to execute the script through a .bat file it gives me the error ‘ModuleNotFoundError: No module named ‘selenium” from selenium import …

Total answers: 2

Batch file not running python script in task scheduler

Batch file not running python script in task scheduler Question: I have a scraping python script and a batch file that when run from CMD works perfectly however when I try to run it from Task Scheduler nothing happens. I know there are a lot of questions regarding the same issue but I have tried …

Total answers: 1

Batch that monitors and restarts a python

Batch that monitors and restarts a python Question: I’m trying to make a batch that restarts my python files whenever any of them close or crash, with the following command: @echo off :a cd C:UsersPCDesktoptestfolder test1.py test2.py test2.py goto a but it is not working, what should I do? Asked By: Lucas Tesch || Source …

Total answers: 1