0

I made a python code that must sequentially execute a series of perl commands on the PC shell, the problem is that I did not realize that to send these scripts I have to add parameters (i have n_params), advice?

example command to send perl [file_name.pl] [params]

To run these commands on the windows CMD I am using os and subprocess

python code example

# command = perl [file_name.pl] [params]
# path = location/of/where/the/pl/file/is/saved

perl_script = subprocess.Popen(["C:\\Perl64\\bin\\perl.exe",path + command], stdout=sys.stdout)
perl_script.communicate()

But running the script like this, the code gets me wrong because it says it can't find the filename in the specific directory

1
  • ["C:\\Perl64\\bin\\perl.exe", path + command] does not look correct. I think it should be ["C:\\Perl64\\bin\\perl.exe", path+"file_name.pl", "param1", "param2", ...] Commented Feb 23, 2021 at 16:00

1 Answer 1

2

This argument to Popen()

["C:\\Perl64\\bin\\perl.exe", path + command] 

does not look correct since you wrote that command is perl [file_name.pl] [params]. Instead try:

p = subprocess.Popen(["C:\\Perl64\\bin\\perl.exe", path+"file_name.pl", "param1", "param2", ...])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.