How to run vbs from Python? [duplicate] - python

This question already has answers here:
How do I execute a program or call a system command?
(65 answers)
Closed 5 years ago.
I'm working on a GitHub project. It's a text editor built in Python. I need to be able to run error.vbs from test.py.
How or is this possible?

Nevermind.
I just found it out:
import os
os.system("filename.vbs 1")

Related

Using pytest from a BAT file [duplicate]

This question already has answers here:
How to start Python virtual environment in .bat batch file?
(2 answers)
Closed 2 years ago.
I am trying to using pytest from a BAT file. I have tried something like this
..\venv\Scripts\activate.bat
pytest -v src/datasets_test.py::TestDatasetsOperations::test_dataset_add
But it seems to do nothing. How can I make it work?
EDIT: the question is similar, but no one will go to other question if he thinks the error is with pytest
In order to call another script from a batch script, you need to use call.
call ..\venv\Scripts\activate.bat
pytest -v src/datasets_test.py::TestDatasetsOperations::test_dataset_add

Call a powershell script (on a network drive) from python? [duplicate]

This question already has answers here:
How do I execute a program or call a system command?
(65 answers)
Closed 4 years ago.
How do I call a powershell script from python but the ps script lies on a network drive?
Did you try?
import subprocess
subprocess.call("powershell \\path\to\script.ps1")

Self executable python file [duplicate]

This question already has answers here:
How to run a python script at a specific time(s)
(4 answers)
Closed 6 years ago.
Actually, I am new to python and I want to download some content from a website daily. So what can I use to run that file each day?
Any help would be appreciated!
If you use Unix based system, you may put daily cronjob.
Also there are some alternatives for Windows :
What is the Windows version of cron?
In this way script that you want will be automatic executed.

Run Rsync from Python [duplicate]

This question already has answers here:
How do I execute a program or call a system command?
(65 answers)
Closed 9 years ago.
I need to run an rsync command from Python. Is this possible and if so, how do I do it?
rsync -Ccavz --delete DJStatic username#website
You can call a subprocess from python using the following snippet
import subprocess
subprocess.call(["ls", "-l"])
In your case, it would be something like this
subprocess.call(["rsync", "-Ccavz", "--delete","DJStatic", "username#website"])
See here for more details.

Hide console from Python script? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to hide console window in python?
I have a simple script with one messagedialog only...
how can I hide the console from it when I execute the app?
Execute the script using pythonw.exe rather than python.exe. You can set that up to happen automatically by giving the script the extension .pyw rather than .py.

Categories