Python Forum
How to pass arguments to popen?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to pass arguments to popen?
#1
I'm trying to pass an argument to the popen function below. I've tried various permutations of syntax, and still can't get it working. What I ultimately want to do is pass an argument to the script, i.e., sys.argv. Can someone show me the syntax for this?

-Thanks


import subprocess

myfile = "C:\Users\joe\Pictures\Spirit Animals.jpg"

subprocess.Popen(['C:\Program Files (x86)\XYplorer\XYplorer.exe', "myfile"])
Reply


Messages In This Thread
How to pass arguments to popen? - by zBernie - Jul-08-2018, 04:46 AM
RE: How to pass arguments to popen? - by buran - Jul-08-2018, 05:10 AM
RE: How to pass arguments to popen? - by zBernie - Jul-09-2018, 01:26 AM
RE: How to pass arguments to popen? - by volcano63 - Jul-08-2018, 09:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to pass encrypted pass to pyodbc script tester_V 0 887 Jul-27-2023, 12:40 AM
Last Post: tester_V
  Possible to dynamically pass arguments to a function? grimm1111 2 2,222 Feb-21-2021, 05:57 AM
Last Post: deanhystad
  Why Pass Functions as arguments? muzikman 14 5,763 Jan-18-2021, 12:08 PM
Last Post: Serafim
  how to pass arguments between pythons scripts? electricDesire 2 2,191 Oct-19-2020, 07:19 PM
Last Post: electricDesire
  how to pass the interactive string to Popen subprocess maiya 1 1,897 Sep-18-2020, 09:36 PM
Last Post: Larz60+
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,577 Sep-07-2020, 08:02 AM
Last Post: perfringo
  How to pass multiple arguments into function Mekala 4 2,479 Jul-11-2020, 07:03 AM
Last Post: Mekala
  Pass Arguments to Function phillyfa 2 2,047 Mar-27-2020, 12:05 PM
Last Post: phillyfa
  Pass by reference vs Pass by value leodavinci1990 1 2,227 Nov-20-2019, 02:05 AM
Last Post: jefsummers
  # of Positional arguments to pass for creating an object? burvil 2 3,862 Sep-09-2017, 06:43 PM
Last Post: burvil

Forum Jump:

User Panel Messages

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