Quantcast
Channel: ActiveState Community Site - ActivePython discussion
Viewing all articles
Browse latest Browse all 75

Using Python and Perl in WSF

$
0
0

When using more than one language in a WSF file, I can call a vbscript routine from python:

Python2VbscriptTest.wsf

<?XML Version="1.0" encoding="ISO-8859-1"?>
<?job error="true" debug="false"?>
<package>
        <job>

        <script language="VBScript">
        <![CDATA[
public sub vbsOutput(strText)
        wscript.echo strText & " (from vbsOutput)"
end sub
        ]]>
        </script>

        <script language="Python">
        <![CDATA[
import sys
globals.vbsOutput('python test')
        ]]>
        </script>

        </job>
</package>

This works fine. However when I try to call a Perl script (I'm using ActivePerl) I get an error:

Python2PerlTest.wsf

<?XML Version="1.0" encoding="ISO-8859-1"?>
<?job error="true" debug="false"?>
<package>
        <job>

        <script language="PerlScript">
        <![CDATA[
sub perlOutput
{
  $strText = "$_[0]";
  $WScript->Echo("$strText (from perlOutput)");
}
        ]]>
        </script>

        <script language="Python">
        <![CDATA[
import sys
globals.perlOutput('python test')
        ]]>
        </script>

        </job>
</package>

Error message is:

X:\>cscript Python2PerlTest.wsf
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

(from perlOutput)
X:\Python2PerlTest.wsf(0, 0) Python ActiveX Scripting Engine: Traceback (most recent call last):
TypeError: 'NoneType' object is not callable

I can call a python routine from perl. In fact i can use this method to call any of the 4 languages I'm using (vbscript, jscript, perl, python) from any of the other languages except Python calling a perl routine. Does anyone know what I am doing wrong?

Thanks,


Viewing all articles
Browse latest Browse all 75

Trending Articles