473,388 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

executing python within perl script

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
Jul 18 '05 #1
0 1822

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Erik Johnson | last post by:
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather...
1
by: Sean | last post by:
I can connect to a machine remotely with no problems but I'm having trouble trying to create a process remotely. Initially this was a perl and VB script which I'm converting to python. Its entire...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
0
by: Nick Coghlan | last post by:
Anyone playing with the CPython interpreter's new command line switch might have noticed that it only works with top-level modules (i.e. scripts that are directly on sys.path). If the script is...
3
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be...
4
by: lorinh | last post by:
Hi Folks, I'm trying to strip C/C++ style comments (/* ... */ or // ) from source code using Python regexps. If I don't have to worry about comments embedded in strings, it seems pretty...
3
by: Pankaj | last post by:
I am facing a very basic problem as any new bie would face. I know perl and now i want to use python In perl, it is very simple , just "perl scriptname.pl" will execute the script. But i...
1
by: amaltasb | last post by:
I have few modules which are in perl, and all other scripts are in python. Is it possible to execute the perl scripts within python or import them like: Thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.