Pyro4 complains when imported by Jython 2.5 -- patch attached
Lars Buitinck <[email protected]>
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <CAKz-xUd4Kr816QkK9ViXJmVmhsjAS4FU3zdon-SJU43UN4NVOw@mail.gmail.com> |
Hi all, While trying to use Pyro4 in a joint Python/Jython project, I found that it gives a warning when imported in Jython 2.5, currently the stable version. Since Jy2.5 should be supported per the docs, I decided to put in a check for Jython. The patch is attached (I hope this is the proper way to submit a patch). Regards, Lars Buitinck Scientific programmer, U. Amsterdam ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Pyro-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyro-core
no-warning-jy25.patch
(text/x-patch, 1.2 KB)
Index: src/Pyro4/__init__.py =================================================================== --- src/Pyro4/__init__.py (revision 716) +++ src/Pyro4/__init__.py (working copy) @@ -4,10 +4,17 @@ Pyro - Python Remote Objects. Copyright by Irmen de Jong ([email protected]). """ +import platform import sys + if sys.version_info < (2, 6): import warnings - warnings.warn("This Pyro version is unsupported on Python versions older than 2.6", RuntimeWarning) + if platform.system() == "Java" and sys.version_info < (2, 5): + warnings.warn("This Pyro version is unsupported on Jython versions" + " older than 2.5", ImportWarning) + else: + warnings.warn("This Pyro version is unsupported on Python versions" + " older than 2.6", ImportWarning) def _configLogging(): Index: setup.py =================================================================== --- setup.py (revision 716) +++ setup.py (working copy) @@ -9,6 +9,8 @@ if __name__ == '__main__' : sys.path.insert(0, "src") + import warnings + warnings.simplefilter("default", ImportWarning) import Pyro4.constants print('Pyro version = %s' % Pyro4.constants.VERSION)