Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > executing python within perl script

Thread Tools

executing python within perl script

Posts: n/a
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/"
, line 228, in ?
__internal__ = internal_storage()
File "/apps/relibase/python/reliscript/python/"
, line 25, in __init__
import re; = re
File "/apps/relibase/python/Python-2.1.1/Lib/", line 28
, in ?
from sre import *
File "/apps/relibase/python/Python-2.1.1/Lib/", line 1
7, in ?
import sre_compile
File "/apps/relibase/python/Python-2.1.1/Lib/"
, line 15, in ?
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble running Perl script from within a Perl script Perl Misc 4 07-29-2011 01:44 PM
Issue in executing more than one perl script from Single perl script Perl Misc 3 11-01-2007 06:19 PM
executing perl script within python Python 1 04-12-2006 07:31 AM
executing a python script from another python script. sarmin kho Python 1 06-04-2004 01:12 PM
Loading and executing an arbitrary Python script from within Python TheDustbustr Python 2 08-17-2003 02:42 AM