ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-dev
Jython-dev
Re: [Jython-dev] Having trouble using telnetlib.py
by Kent Johnson other posts by this author
Nov 14 2003 1:42PM messages near this date
[Jython-dev] Having trouble using telnetlib.py | [Jython-dev] [ jython-Patches-838244 ] Bug [761177] Problem comparing Java objects
Your understanding is correct. If a module requires a Python 
extension module written in C, you cannot use that module in Jython.

Your best option is to find another library that is either pure 
Python (no C extensions needed) or Java (Java libraries are usable 
from Jython). Other options are to rewrite the library so it doesn't 
need the C extension, or port the C extension to Java to create a 
Jython version (BTW this has been done with many library modules 
already).

Kent

At 11:04 AM -0500 11/11/03, Anand, Shashvat wrote:
> Hi there,
> I'm new to jython and am trying to port some simple code written in 
> python to jython.  The main problem I am having is importing 
> telnetlib.py.
> I continue to get the message "ImportError: no module named select"
> 
> Looking at http://www.jython.org/docs/differences.html, I think my 
> understanding is that select is a built in extension module that 
> doesn't exist in Jython.  But, I'm a little confused because does 
> that mean that I can't use telnetlib.py?  Is there some other way to 
> get around this?
> 
> I did look on the newsgroups for jython, and the last person with 
> this problem was in 2001, but I didn't quite understand how it was 
> solved.
> 
> Looking for some assistance.   Here's the beginning of my code. 
> 
> import org.python.util.PythonInterpreter;
> import org.python.core.*;
> 
> public class SimpleEmbedded
> {
>      public static void main(String []args)
>                 throws PyException
>      {
>                 PythonInterpreter interp =
>                     new PythonInterpreter();
> 
>                 System.out.println("Hello, brave new world");
> 
> 
> //               interp.exec("import getpass");
>                 interp.exec("import sys");
>                 interp.exec("import telnetlib");   
> 
> 
>                 interp.set("a", new PyInteger(42));
>                 interp.exec("print a");
>                 interp.exec("x = 2+2");
>                 PyObject x = interp.get("x");
>                 System.out.println("x: "+x);
>                 System.out.println("Goodbye, cruel world");
>      }
> }
> 
> 
> Just running this code gives me the error. 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: ApacheCon 2003,
> 16-19 November in Las Vegas. Learn firsthand the latest
> developments in Apache, PHP, Perl, XML, Java, MySQL,
> WebDAV, and more! http://www.apachecon.com/
> _______________________________________________
> Jython-dev mailing list
> Jython-dev@[...].net
> https://lists.sourceforge.net/lists/listinfo/jython-dev



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Jython-dev mailing list
Jython-dev@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Thread:
Anand, Shashvat
Kent Johnson

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved