Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python27 support missing #15

Open
chorejasbob opened this issue Jun 27, 2019 · 3 comments
Open

python27 support missing #15

chorejasbob opened this issue Jun 27, 2019 · 3 comments

Comments

@chorejasbob
Copy link

The current python init.py module is not python27 compatible. Would it be possible to add support for python 2.7? I've created the following diff, which adds python2.7 support:

https://gist.github.com/chorejasbob/25ae63bc008e78d712e80daba986a6ef

@chorejasbob
Copy link
Author

I've verified that the patch works on 2.7:

$ ipython
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:import jmxquery
jmxConnection = jmxquery.JMXConnection("service:jmx:rmi:///jndi/rmi://<dummyIP>:12347/jmxrmi")
jmxQuery = [jmxquery.JMXQuery("com.bea:ServerRuntime=AdminServer,Type=ThreadPoolRuntime,Name=ThreadPoolRuntime")]
metrics = jmxConnect:ion.query(jmxQuery)::
:--

In [2]: metrics
Out[2]:
[<jmxquery.JMXQuery instance at 0x7f80134d2ef0>,
 <jmxquery.JMXQuery instance at 0x7f80134d2f38>,
 <jmxquery.JMXQuery instance at 0x7f80134d2f80>,
 <jmxquery.JMXQuery instance at 0x7f80134d2fc8>,
 <jmxquery.JMXQuery instance at 0x7f80134ed050>,
 <jmxquery.JMXQuery instance at 0x7f80134ed098>,
 <jmxquery.JMXQuery instance at 0x7f80134ed0e0>,
 <jmxquery.JMXQuery instance at 0x7f80134ed128>,
 <jmxquery.JMXQuery instance at 0x7f80134ed170>,
 <jmxquery.JMXQuery instance at 0x7f80134ed1b8>,
 <jmxquery.JMXQuery instance at 0x7f80134ed200>,
 <jmxquery.JMXQuery instance at 0x7f80134ed248>,
 <jmxquery.JMXQuery instance at 0x7f80134ed290>,
 <jmxquery.JMXQuery instance at 0x7f80134ed2d8>,
 <jmxquery.JMXQuery instance at 0x7f80134ed320>,
 <jmxquery.JMXQuery instance at 0x7f80134ed368>,
 <jmxquery.JMXQuery instance at 0x7f80134ed3b0>,
 <jmxquery.JMXQuery instance at 0x7f80134ed3f8>,
 <jmxquery.JMXQuery instance at 0x7f80134ed440>]

In [3]: quit()

@dgildeh
Copy link
Owner

dgildeh commented Nov 15, 2019

Hi @chorejasbob this isn't something I'm planning to do anytime soon. If you do a PR with the fix I can review and test then I'll look into merging it. Not sure what the clean way of supporting both versions in a single module is so will also need to do some research!

@chorejasbob
Copy link
Author

Hi @dgildeh I've updated the 2.7 code to include the 'subprocess32' module, since it backports all of the newer functionality available in the python 3 version of the subprocess module. You can read more about it here: https://pypi.org/project/subprocess32/

I've created a new local branch and will start testing using this module. I'll create a PR once I can test and verify functionality works on both 2.7 and 3.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants