0

I have a script.py in /Users/admin/Desktop and I want to run this script on a file that is in /Users/admin//Desktop/folder/file.txt, without changing the present dir.

Question: what is the most efficient way to do that on command-line ? I am using the following commands and results are not as expected.

$ python script.py --script; /Users/admin/Desktop/file.txt

     raise StopIteration('because of missing file (file.txt)')

 StopIteration: because of missing file (file.txt)
user3698773
  • 929
  • 2
  • 8
  • 15

1 Answers1

1
  1. Remove the semicolon because that will prematurely terminate the command.
  2. Pass the correct path to the file to your program. You say it is /Users/admin/Desktop/folder/file.txt, however, your command is using /Users/admin/Desktop/file.txt (it's missing folder)

So the command should (probably) be:

$ python script.py --script /Users/admin/Desktop/folder/file.txt

If that doesn't work you will need to edit your question to show your code.

mhawke
  • 84,695
  • 9
  • 117
  • 138