Python Forum
Help with run commands from a python script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with run commands from a python script
#2
If pass in a string command need shell=True.
Better and safer to pass in a list.
Can try:
import subprocess

subprocess.Popen([r'C:\Program Files\Blender Foundation\Blender\blender.exe', 'untitled', '02.blend', '-b', '-a'])
If you use blender some should also add it to Windows Path.
Then can call just blender.
import subprocess

subprocess.Popen(['blender', 'untitled', '02.blend', '-b', '-a'])
Reply


Messages In This Thread
RE: Help with run commands from a python script - by snippsat - Apr-21-2018, 12:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,592 Jun-29-2023, 11:57 AM
Last Post: gologica
  Sending string commands from Python to a bluetooth device Rovelin 13 9,903 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  Python library for win32 console commands eldiener 3 3,611 Aug-24-2021, 10:28 PM
Last Post: bowlofred
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 2,338 May-18-2021, 06:31 AM
Last Post: Skaperen
  cant use ping, sudo or other commands in remote shell script. throwaway34 7 3,755 May-17-2021, 11:29 AM
Last Post: throwaway34
  Raspi Commands via Python (VS Code) Script AS4188 5 2,915 Oct-21-2020, 03:49 PM
Last Post: AS4188
  How to kill a bash script running as root from a python script? jc_lafleur 4 6,115 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,395 May-28-2020, 05:27 PM
Last Post: micseydel
  how to get PID's of linux commands executed through python modules? Manikandan_PS 4 3,152 Mar-12-2020, 07:16 AM
Last Post: Manikandan_PS
  Questions re: my first python app (GUI, cross-platform, admin/root-level commands)? DonnyBahama 0 1,787 Feb-27-2020, 08:14 PM
Last Post: DonnyBahama

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020