executing python within perl script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SS

    executing python within perl script

    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_storag e()
    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
Working...