How to call perl script in Python script?

0 votes

How to call Perl script in Python script?

Oct 6 in Python by anonymous
• 6,190 points
251 views

2 answers to this question.

0 votes

Open your Python code in your Python editor of choice.

Go to the line in the code where you want to run your Perl script.

Type "pyth.RunPerl.ext;" where "Full Path To File" is the full path filename of your Perl file. This will cause Python to execute the Perl file, then continue down the line with the rest of your Python code.

answered Oct 6 by Gitika
• 50,620 points
0 votes

If you just want to open a pipe to a Perl interpreter, you're on the right track. The only thing I think you're missing is that the Perl script itself is not executable. So you need to do this:

var = "/some/file/path/"
pipe = subprocess.Popen(["perl", "./uireplace.pl", var], stdin=subprocess.PIPE)
pipe.stdin.write(var)
pipe.stdin.close()
answered Oct 6 by Reshma

Related Questions In Python

0 votes
1 answer

how to exit a python script in an if statement

This works fine for me: while True: ...READ MORE

answered Sep 19, 2018 in Python by bug_seeker
• 15,510 points
32,824 views
+1 vote
1 answer

How to Profile a script in Python

Python includes a profiler called cProfile. It ...READ MORE

answered Nov 21, 2018 in Python by SDeb
• 13,250 points
527 views
0 votes
1 answer

How to call Python script from bash with an agrument?

Hi, You need to call the same command ...READ MORE

answered Jun 24, 2019 in Python by Shabnam
• 930 points
4,938 views
0 votes
1 answer

How to call a function from another file in Python?

Hi@akhtar, You can use the import keyword to ...READ MORE

answered Jun 24 in Python by MD
• 79,930 points
290 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,186 views
+1 vote
8 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

Just for the record: >>> int('55063.000000') Traceback (most recent ...READ MORE

answered Aug 17 in Python by pakainfo
• 200 points
182,778 views
0 votes
1 answer

how to play audio highlights his text in python?

Hey, You can split the audio files into ...READ MORE

answered Mar 27 in Python by Gitika
• 50,620 points
285 views