How to call perl script in Python script

0 votes

How to call Perl script in Python script?

Oct 7, 2020 in Python by anonymous
• 10,480 points
13,524 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 7, 2020 by Gitika
• 65,770 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 7, 2020 by Reshma

Related Questions In Python

+1 vote
5 answers

how to exit a python script in an if statement

Instead of using the normal UTF-8 encoding, ...READ MORE

answered Jul 4, 2023 in Python by bodymist
• 140 points
355,409 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,300 points
1,868 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 25, 2019 in Python by Shabnam
• 930 points
11,889 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, 2020 in Python by MD
• 95,460 points
5,247 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 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,790 points
4,069 views
+2 votes
10 answers

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

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,560 points
409,220 views
0 votes
4 answers

How to print objects of class using print function in Python?

>>> class Test: ... ...READ MORE

answered Dec 16, 2020 in Python by Roshni
• 10,480 points
78,510 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP