[Zope] telnetlib script help
Jack Coates
jack at monkeynoodle.org
Sun Sep 7 16:33:16 EDT 2003
Figured it out -- when putting it into an external method, I needed to
return instead of just printing.
Off to the regex'ing of output now...
thanks
Jack
On Sun, 2003-09-07 at 00:12, Edward Muller wrote:
> Put the script in an External Method is the easiest solution most
> likely.
>
> Basically what's happening is that some python modules are considered
> unsafe so you can't access them directly inside of zope without changing
> zope's module permissions.
>
> The easiest work around is to put these methods into an external method.
>
> Hope that helps
>
> On Sat, 2003-09-06 at 18:09, Jack Coates wrote:
> > Hi,
> >
> > I'm fair-to-middlin' with Perl and have no Python knowledge. I'm trying
> > to do a Python script which grabs some information from a telnet
> > interface on the same machine:
> >
> > import sys
> > import telnetlib
> >
> > HOST = "localhost"
> >
> > tn = telnetlib.Telnet(HOST, 9090)
> >
> > tn.write("title ?\n")
> > tn.write("album ?\n")
> > tn.write("artist ?\n")
> > tn.write("exit\n")
> >
> > print tn.read_all()
> >
> > That works from the command line (well, I'll be figuring out how to
> > regex-prettify the output later), but doesn't work from Zope: I've
> > enabled import of sys and telnetlib, but it now pops up auth dialogs
> > repeatedly. Hitting cancel makes it say "
> > Error Value: You are not allowed to access write in this context".
> >
> > What am I doing wrong? I'm open to making it an external method, but
> > when I tried to do so it quit working from the command line.
> >
> > thanks,
--
Jack Coates
Monkeynoodle: A Scientific Venture...
More information about the Zope
mailing list