1

I have a python script that I need to run 8 times, with 8 different .txt-files. I'm trying to do this with a parallel{}-section in PowerShell.

workflow my_script{
  parallel {  
  python bin/script.py config/file1.txt
  python bin/script.py config/file2.txt
  python bin/script.py config/file3.txt
  python bin/script.py config/file4.txt
  python bin/script.py config/file5.txt
  python bin/script.py config/file6.txt
  python bin/script.py config/file7.txt
  python bin/script.py config/file8.txt
  } }

However this does not work, I'm getting the "no such file or directory" on script.py.

I'm already in the right directory, in fact if I do python bin/script.py config/file1.txt this works just fine.

Calling workflow implies that directory is changed? I don't understand why it is not running in the working directory.

user3666197
  • 1
  • 6
  • 50
  • 92
  • Does using a full path to config files work? – vonPryz Nov 04 '20 at 08:58
  • Yes and no. Using the absolute path starts the script, but the script stops because it uses `sys.argv` inside the script, so it needs to be executed from the right folder. Is there a way of specifying the right starting path at the beginning of this workflow? – Leonardo Sanna Nov 04 '20 at 09:03
  • Workflow shouldn't change the path. Use Python's methods to [find out](https://stackoverflow.com/a/5137509/503046) in which directory you end up. Maybe that will provide more clues. – vonPryz Nov 04 '20 at 10:21
  • Actually it is changing. Normal execution is in the current wd, when I call `workflow` it is a different dir, despite the PowerShell path is the same. My folder is in `...documents/github/folde1/folder2` while workflow starts from `...documents` – Leonardo Sanna Nov 04 '20 at 10:57
  • For the moment I managed it with a workaround, copying the folder I need into `documents` – Leonardo Sanna Nov 04 '20 at 12:34

0 Answers0