executing python within perl script

S

SS

I am trying to execute some python commands within a perl script and
running into problems. The following works:
python -c "import mypkg;do this; do that"
however when I try to do something like
#!/bin/perl -w
......
......
$cmd = "import mypkg; do this; do that";
$string = `python -c \"$cmd\"`;

and execute this perl script I get error:

Traceback (most recent call last):
File "<string>", line 1, in ?
File "/apps/relibase/python/reliscript/python/reliscript.py"
, line 228, in ?
__internal__ = internal_storage()
File "/apps/relibase/python/reliscript/python/reliscript.py"
, line 25, in __init__
import re; self.re = re
File "/apps/relibase/python/Python-2.1.1/Lib/re.py", line 28
, in ?
from sre import *
File "/apps/relibase/python/Python-2.1.1/Lib/sre.py", line 1
7, in ?
import sre_compile
File "/apps/relibase/python/Python-2.1.1/Lib/sre_compile.py"
, line 15, in ?
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top