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?
#3
You need either to escape backslashes or prepend the path string with r prefix to force its interpretation as a raw string
r'C:\Program Files (x86)\XYplorer\XYplorer.exe'

backslash is an escape character in Python string, so the way you wrote it each character after backslash is interpreted differently.

PS same goes for myfile (with heading @buran's advice re uncommenting).

PPS Posting exception message next time may be a good idea
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
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 912 Jul-27-2023, 12:40 AM
Last Post: tester_V
  Possible to dynamically pass arguments to a function? grimm1111 2 2,250 Feb-21-2021, 05:57 AM
Last Post: deanhystad
  Why Pass Functions as arguments? muzikman 14 5,834 Jan-18-2021, 12:08 PM
Last Post: Serafim
  how to pass arguments between pythons scripts? electricDesire 2 2,214 Oct-19-2020, 07:19 PM
Last Post: electricDesire
  how to pass the interactive string to Popen subprocess maiya 1 1,912 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,601 Sep-07-2020, 08:02 AM
Last Post: perfringo
  How to pass multiple arguments into function Mekala 4 2,498 Jul-11-2020, 07:03 AM
Last Post: Mekala
  Pass Arguments to Function phillyfa 2 2,072 Mar-27-2020, 12:05 PM
Last Post: phillyfa
  Pass by reference vs Pass by value leodavinci1990 1 2,255 Nov-20-2019, 02:05 AM
Last Post: jefsummers
  # of Positional arguments to pass for creating an object? burvil 2 3,889 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