Re: Running Inline::Python in a CGI script

[email protected] (Chris Nighswonger)
Newsgroups perl.inline
Message-ID <CAP3yOonQYB32Swge_W+cjx+7hdGgKtUfqerERguDSfpZnAfkyg@mail.gmail.com>
On Tue, Mar 12, 2013 at 9:43 AM, Stefan Seifert <[email protected]> wrote:

> # create a Python foo.Bar object and make it look like a Bar object in
> Perl:
> my $bar = py_new_object('Bar', 'foo', 'Bar', 'constructor arg 1');
> $bar->baz();
>

So here's my shot at this:

use Inline::Python qw( py_new_object );

my $pykota_conf = py_new_object("config", "pykota.config", "PyKotaConfig",
'/etc/pykota/');
print "Admin mail for the AP400N: " . $pykota_conf->getAdminMail('AP400N')
. "\n";

And here's what it says when I execute it at the cli:

root@biblios:/usr/share/webmin/pykota (0.02_pre_alpha *)# ./PyKotaConfig.cgi
'PyKotaConfig' is not a callable object at
/usr/local/lib/perl/5.14.2/Inline/Python.pm line 317.

Keep in mind all of my experience lies with Perl, and I have basically zero
experience with Python, so I may be misunderstanding how Python
packages/classes are referenced.

When I do py_study_package, PyKotaConfig clearly shows up as a class,
though.

Kind Regards,
Christopher
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.