|
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 |