From: Eli A. <el...@ce...> - 2001-03-02 19:27:24
|
Hi. At Finn's advice, I recently compiled the CVS version of Jython in order to use the new rich comparisons. They work great! However, I can no longer "import re". I get ImportError: no module named re This module was recently a topic of some changes. Can someone explain how to accommodate the recent changes? .... or verify that these changes are supposed to be invisible from the point of view of the user, so that I can look for some other path issue? Thanks, Eli |
From: <bc...@wo...> - 2001-03-02 20:48:24
|
[Eli Ateljevich] >Hi. At Finn's advice, I recently compiled the CVS version of Jython in >order to use the new rich comparisons. They work great! However, I can no >longer "import re". I get >ImportError: no module named re > >This module was recently a topic of some changes. Can someone explain how >to accommodate the recent changes? .... or verify that these changes are >supposed to be invisible from the point of view of the user, so that I can >look for some other path issue? The CVS version does *not* contain any of the module that are a straight copy of the CPython modules. Instead you will have to get a recent CVS copy of CPython and use the modules there. Personally I have a setup where my <home>/.jython contains: python.path = i:\\python\\python\\dist\\src\\Lib which is the directory where I have my CVS copy of CPython. This setup works most of the time. The "re" (actually the "sre") module is quite sensitive to the correct synchronization between the the "_sre" module, which is part of jython and the "re.py" module, which is part of CPython. At the moment the two versions are synchronized so you should be able to use this combination of Jython CVS and CPython CVS. http://sourceforge.net/cvs/?group_id=5470 regards, finn |
From: Brian Z. <bri...@ya...> - 2001-03-02 22:10:53
|
[bzhou@server7 jython-cvs]$ /usr/java/jdk1.3/jre/bin/java -Dpython.home=/usr/local/jython-2.0 -class path "./jython.jar" org.python.util.jython Jython 2.1pre-a1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import re >>> Mine works fine. "python.home" setting? /Brian ----- Original Message ----- From: "Eli Ateljevich" <el...@ce...> To: <jyt...@li...> Sent: Friday, March 02, 2001 11:27 AM Subject: [Jython-dev] Re module status in CVS > Hi. At Finn's advice, I recently compiled the CVS version of Jython in > order to use the new rich comparisons. They work great! However, I can no > longer "import re". I get > ImportError: no module named re > > This module was recently a topic of some changes. Can someone explain how > to accommodate the recent changes? .... or verify that these changes are > supposed to be invisible from the point of view of the user, so that I can > look for some other path issue? > Thanks, > Eli > > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-dev > |
From: Brian Z. <bri...@ya...> - 2001-03-02 22:19:39
|
>>> import stat >>> dir(stat) ['ST_ATIME', 'ST_CTIME', 'ST_DEV', 'ST_GID', 'ST_INO', 'ST_MODE', 'ST_MTIME', 'ST_NLINK', 'ST_SIZE', 'ST_UID', 'S_ENFMT', 'S_IEXEC', 'S_IFBLK', 'S_IFCHR', 'S_IFDIR', 'S_IFIFO', 'S_IFLNK', 'S_IFMT', 'S_IFREG', 'S_IFSOCK', 'S_IMODE', 'S_IREAD', 'S_IRGRP', 'S_IROTH', 'S_IRUSR', 'S_IRWXG', 'S_IRWXO', 'S_IRWXU', 'S_ISBLK', 'S_ISCHR', 'S_ISDIR', 'S_ISFIFO', 'S_ISGID', 'S_ISLNK', 'S_ISREG', 'S_ISSOCK', 'S_ISUID', 'S_ISVTX', 'S_IWGRP', 'S_IWOTH', 'S_IWRITE', 'S_IWUSR', 'S_IXGRP', 'S_IXOTH', 'S_IXUSR', '__doc__', '__file__', '__name__'] >>> import errno Traceback (innermost last): File "<console>", line 1, in ? ImportError: no module named errno It's not a problem by itself in jython, but I want make the following code portable between python and jython, and am wondering if the errno module can be added to the standard jython installation. < if os.name == 'nt': < try: < os.remove(new_filename) < except OSError, er: < if er.errno <> errno.ENOENT: raise er < os.rename(tmp_filename, new_filename) Thanks, /Brian |
From: <bc...@wo...> - 2001-03-02 22:28:55
|
[Brian Zhou] >>>> import stat >>>> dir(stat) >['ST_ATIME', 'ST_CTIME', 'ST_DEV', 'ST_GID', 'ST_INO', 'ST_MODE', >'ST_MTIME', 'ST_NLINK', 'ST_SIZE', 'ST_UID', 'S_ENFMT', 'S_IEXEC', >'S_IFBLK', 'S_IFCHR', 'S_IFDIR', 'S_IFIFO', 'S_IFLNK', 'S_IFMT', >'S_IFREG', 'S_IFSOCK', 'S_IMODE', 'S_IREAD', 'S_IRGRP', 'S_IROTH', >'S_IRUSR', 'S_IRWXG', 'S_IRWXO', 'S_IRWXU', 'S_ISBLK', 'S_ISCHR', >'S_ISDIR', 'S_ISFIFO', 'S_ISGID', 'S_ISLNK', 'S_ISREG', 'S_ISSOCK', >'S_ISUID', 'S_ISVTX', 'S_IWGRP', 'S_IWOTH', 'S_IWRITE', 'S_IWUSR', >'S_IXGRP', 'S_IXOTH', 'S_IXUSR', '__doc__', '__file__', '__name__'] >>>> import errno >Traceback (innermost last): > File "<console>", line 1, in ? >ImportError: no module named errno > >It's not a problem by itself in jython, but I want make the following >code portable between python and jython, and am wondering if the errno >module can be added to the standard jython installation. > >< if os.name == 'nt': >< try: >< os.remove(new_filename) >< except OSError, er: >< if er.errno <> errno.ENOENT: raise er >< os.rename(tmp_filename, new_filename) While portability have my fullest attention, I really don't know what values we should give the fields in the "errno" module. The raise statements in javaos all set .errno to 0 because there are no corresponding errno field in java. The best solution I can suggest, is to add if os.name == 'java': or if sys.platform[:4] == 'java': to your code. regards, finn |