| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>6. Frequently Asked Questions — Py4J</title>
- <link rel="stylesheet" href="_static/py4jdoc.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: './',
- VERSION: '0.8.1',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: 'true'
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="author" title="About these documents" href="about.html" />
- <link rel="top" title="Py4J" href="index.html" />
- <link rel="next" title="7. Contributing to Py4J" href="contributing.html" />
- <link rel="prev" title="5. Py4J Java API" href="py4j_java.html" />
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-18626179-1']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
- </head>
- <body>
- <div class="page">
- <div class="banner">Py4J - A Bridge between Python and Java</div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 5px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="contributing.html" title="7. Contributing to Py4J"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="py4j_java.html" title="5. Py4J Java API"
- accesskey="P">previous</a> |</li>
- <li><a href="index.html">Home</a> |</li>
- <li><a href="download.html">Download</a> |</li>
- <li><a href="contents.html">Doc</a> |</li>
- <li><a href="https://blog.py4j.org">Blog</a> |</li>
- <li><a href="https://github.com/bartdag/py4j">github</a> |</li>
- <li><a href="about.html">About</a> »</li>
-
- </ul>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <h3><a href="contents.html">On This Page</a></h3>
- <ul>
- <li><a class="reference internal" href="#">6. Frequently Asked Questions</a><ul>
- <li><a class="reference internal" href="#how-to-turn-logging-on-off">6.1. How to turn logging on/off?</a></li>
- <li><a class="reference internal" href="#how-to-call-a-constructor">6.2. How to call a constructor?</a></li>
- <li><a class="reference internal" href="#how-to-call-a-static-method">6.3. How to call a static method?</a></li>
- <li><a class="reference internal" href="#how-to-access-a-field">6.4. How to access a field?</a></li>
- <li><a class="reference internal" href="#how-to-import-a-class">6.5. How to import a class?</a></li>
- <li><a class="reference internal" href="#how-to-create-an-array">6.6. How to create an array?</a></li>
- <li><a class="reference internal" href="#what-ports-are-used-by-py4j">6.7. What ports are used by Py4J?</a></li>
- <li><a class="reference internal" href="#is-py4j-thread-safe">6.8. Is Py4J thread-safe?</a></li>
- <li><a class="reference internal" href="#how-can-i-use-py4j-with-eclipse">6.9. How can I use Py4J with Eclipse?</a></li>
- <li><a class="reference internal" href="#can-i-use-py4j-with-python-3">6.10. Can I use Py4J with Python 3?</a></li>
- <li><a class="reference internal" href="#are-there-any-security-concerns-with-py4j">6.11. Are there any security concerns with Py4J?</a></li>
- <li><a class="reference internal" href="#i-found-a-bug-how-do-i-report-it">6.12. I found a bug, how do I report it?</a></li>
- <li><a class="reference internal" href="#how-can-i-contribute">6.13. How can I contribute?</a></li>
- </ul>
- </li>
- </ul>
- <h4>Previous topic</h4>
- <p class="topless"><a href="py4j_java.html"
- title="previous chapter">5. Py4J Java API</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="contributing.html"
- title="next chapter">7. Contributing to Py4J</a></p>
- <h3>This Page</h3>
- <ul class="this-page-menu">
- <li><a href="_sources/faq.txt"
- rel="nofollow">Show Source</a></li>
- </ul>
- <div id="searchbox" style="display: none">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" size="18" />
- <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
- <div class="section" id="frequently-asked-questions">
- <h1>6. Frequently Asked Questions<a class="headerlink" href="#frequently-asked-questions" title="Permalink to this headline">¶</a></h1>
- <div class="contents local topic" id="summary">
- <p class="topic-title first">Summary</p>
- <ul class="simple">
- <li><a class="reference internal" href="#how-to-turn-logging-on-off" id="id3">How to turn logging on/off?</a></li>
- <li><a class="reference internal" href="#how-to-call-a-constructor" id="id4">How to call a constructor?</a></li>
- <li><a class="reference internal" href="#how-to-call-a-static-method" id="id5">How to call a static method?</a></li>
- <li><a class="reference internal" href="#how-to-access-a-field" id="id6">How to access a field?</a></li>
- <li><a class="reference internal" href="#how-to-import-a-class" id="id7">How to import a class?</a></li>
- <li><a class="reference internal" href="#how-to-create-an-array" id="id8">How to create an array?</a></li>
- <li><a class="reference internal" href="#what-ports-are-used-by-py4j" id="id9">What ports are used by Py4J?</a></li>
- <li><a class="reference internal" href="#is-py4j-thread-safe" id="id10">Is Py4J thread-safe?</a></li>
- <li><a class="reference internal" href="#how-can-i-use-py4j-with-eclipse" id="id11">How can I use Py4J with Eclipse?</a></li>
- <li><a class="reference internal" href="#can-i-use-py4j-with-python-3" id="id12">Can I use Py4J with Python 3?</a></li>
- <li><a class="reference internal" href="#are-there-any-security-concerns-with-py4j" id="id13">Are there any security concerns with Py4J?</a></li>
- <li><a class="reference internal" href="#i-found-a-bug-how-do-i-report-it" id="id14">I found a bug, how do I report it?</a></li>
- <li><a class="reference internal" href="#how-can-i-contribute" id="id15">How can I contribute?</a></li>
- </ul>
- </div>
- <div class="section" id="how-to-turn-logging-on-off">
- <h2><a class="toc-backref" href="#id3">6.1. How to turn logging on/off?</a><a class="headerlink" href="#how-to-turn-logging-on-off" title="Permalink to this headline">¶</a></h2>
- <p>Logging is turned off by default. In Java, simply call
- <code class="docutils literal"><span class="pre">GatewayServer.turnLoggingOn()</span></code> or <code class="docutils literal"><span class="pre">GatewayServer.turnLoggingOff()</span></code>.
- Py4J-java uses the <code class="docutils literal"><span class="pre">java.util.logging</span></code> framework. To get fined-grained
- control over the logging behavior, just obtain a Logger instance by calling
- <code class="docutils literal"><span class="pre">Logger.getLogger("py4j")</span></code>. You can also look at the <a class="reference external" href="http://docs.oracle.com/javase/6/docs/technotes/guides/logging/overview.html">Java Logging Overview</a>
- for more information on this framework.</p>
- <p>For example, in Java, you can do:</p>
- <div class="highlight-java"><div class="highlight"><pre><span class="n">GatewayServer</span><span class="o">.</span><span class="na">turnLoggingOn</span><span class="o">();</span>
- <span class="n">logger</span> <span class="o">=</span> <span class="n">Logger</span><span class="o">.</span><span class="na">getLogger</span><span class="o">(</span><span class="s">"py4j"</span><span class="o">);</span>
- <span class="n">logger</span><span class="o">.</span><span class="na">setLevel</span><span class="o">(</span><span class="n">Level</span><span class="o">.</span><span class="na">ALL</span><span class="o">);</span>
- </pre></div>
- </div>
- <p>In Python, logging can be enabled this way:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s">"py4j"</span><span class="p">)</span>
- <span class="n">logger</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
- <span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">StreamHandler</span><span class="p">())</span>
- </pre></div>
- </div>
- <p><strong>Hint:</strong> you can enable/disable Java logging from Python too:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">py4j</span><span class="o">.</span><span class="n">GatewayServer</span><span class="o">.</span><span class="n">turnLoggingOn</span><span class="p">()</span>
- </pre></div>
- </div>
- </div>
- <div class="section" id="how-to-call-a-constructor">
- <h2><a class="toc-backref" href="#id4">6.2. How to call a constructor?</a><a class="headerlink" href="#how-to-call-a-constructor" title="Permalink to this headline">¶</a></h2>
- <p>Use the <code class="docutils literal"><span class="pre">jvm</span></code> member of a gateway followed by the class’s fully qualified
- name. See <a class="reference internal" href="advanced_topics.html#jvm-views"><span>JVM Views</span></a> to learn how to import packages and
- avoid typing the fully qualified name of classes:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">gateway</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">java_list</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">java</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">ArrayList</span><span class="p">()</span>
- </pre></div>
- </div>
- </div>
- <div class="section" id="how-to-call-a-static-method">
- <h2><a class="toc-backref" href="#id5">6.3. How to call a static method?</a><a class="headerlink" href="#how-to-call-a-static-method" title="Permalink to this headline">¶</a></h2>
- <p>Use the <code class="docutils literal"><span class="pre">jvm</span></code> member of a gateway followed by the fully qualified name of the
- method’s class. Do the same for static fields.</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">gateway</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">System</span><span class="o">.</span><span class="n">currentTimeMillis</span><span class="p">()</span> <span class="c"># equivalent to jvm.java.lang.System...</span>
- </pre></div>
- </div>
- </div>
- <div class="section" id="how-to-access-a-field">
- <h2><a class="toc-backref" href="#id6">6.4. How to access a field?</a><a class="headerlink" href="#how-to-access-a-field" title="Permalink to this headline">¶</a></h2>
- <p>Use the <a class="reference internal" href="py4j_java_gateway.html#py4j.java_gateway.get_field" title="py4j.java_gateway.get_field"><code class="xref py py-func docutils literal"><span class="pre">get_field</span></code></a> function:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">field_value</span> <span class="o">=</span> <span class="n">py4j</span><span class="o">.</span><span class="n">java_gateway</span><span class="o">.</span><span class="n">get_field</span><span class="p">(</span><span class="nb">object</span><span class="p">,</span><span class="s">'public_field'</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>Or you can also set the <a class="reference internal" href="py4j_java_gateway.html#api-gatewayparameters"><span>auto_field</span></a> parameter to
- <cite>True</cite> when you create the gateway:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">gateway</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">(</span><span class="n">GatewayParameters</span><span class="p">(</span><span class="n">auto_field</span><span class="o">=</span><span class="bp">True</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="nb">object</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">entry_point</span><span class="o">.</span><span class="n">getObject</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">field_value</span> <span class="o">=</span> <span class="nb">object</span><span class="o">.</span><span class="n">public_field</span>
- </pre></div>
- </div>
- </div>
- <div class="section" id="how-to-import-a-class">
- <h2><a class="toc-backref" href="#id7">6.5. How to import a class?</a><a class="headerlink" href="#how-to-import-a-class" title="Permalink to this headline">¶</a></h2>
- <p>As in Java, you can always access any class using its fully qualified name, but
- you can also import the fully qualified name to only refer to the simple name
- later on:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">py4j.java_gateway</span> <span class="kn">import</span> <span class="n">JavaGateway</span>
- <span class="gp">>>> </span><span class="kn">from</span> <span class="nn">py4j.java_gateway</span> <span class="kn">import</span> <span class="n">java_import</span>
- <span class="gp">>>> </span><span class="n">gateway</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">jList1</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">java</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">ArrayList</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">java_import</span><span class="p">(</span><span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="p">,</span><span class="s">'java.util.*'</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">jList2</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">ArrayList</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">jMap</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">HashMap</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">java</span><span class="o">.</span><span class="n">lang</span><span class="o">.</span><span class="n">String</span><span class="p">(</span><span class="s">"a"</span><span class="p">)</span>
- <span class="go">u'a'</span>
- <span class="gp">>>> </span><span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">String</span><span class="p">(</span><span class="s">"a"</span><span class="p">)</span>
- <span class="go">u'a'</span>
- </pre></div>
- </div>
- <p>Read how to use <a class="reference internal" href="advanced_topics.html#jvm-views"><span>jvm views</span></a> to make sure that an import
- statement only affects the current Python module.</p>
- </div>
- <div class="section" id="how-to-create-an-array">
- <h2><a class="toc-backref" href="#id8">6.6. How to create an array?</a><a class="headerlink" href="#how-to-create-an-array" title="Permalink to this headline">¶</a></h2>
- <p>Use the <a class="reference internal" href="py4j_java_gateway.html#py4j.java_gateway.JavaGateway.new_array" title="py4j.java_gateway.JavaGateway.new_array"><code class="xref py py-func docutils literal"><span class="pre">new_array</span></code></a> function:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">gateway</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">string_class</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">jvm</span><span class="o">.</span><span class="n">String</span>
- <span class="gp">>>> </span><span class="n">string_array</span> <span class="o">=</span> <span class="n">gateway</span><span class="o">.</span><span class="n">new_array</span><span class="p">(</span><span class="n">string_class</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">string_array</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="s">'Hello World'</span>
- <span class="gp">>>> </span><span class="n">string_array</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">4</span><span class="p">]</span>
- <span class="go">u'Hello World'</span>
- <span class="gp">>>> </span><span class="n">string_array</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span> <span class="ow">is</span> <span class="bp">None</span>
- <span class="go">True</span>
- <span class="gp">>>> </span><span class="n">string_array</span><span class="p">[</span><span class="mi">3</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
- <span class="gt">Traceback (most recent call last):</span>
- <span class="c">...</span>
- <span class="gr">IndexError</span>: <span class="n">list index out of range</span>
- </pre></div>
- </div>
- </div>
- <div class="section" id="what-ports-are-used-by-py4j">
- <h2><a class="toc-backref" href="#id9">6.7. What ports are used by Py4J?</a><a class="headerlink" href="#what-ports-are-used-by-py4j" title="Permalink to this headline">¶</a></h2>
- <p>Py4J by default uses the TCP port 25333 to communicate from Python to Java and
- TCP port 25334 to communicate from Java to Python. It also uses TCP port 25332
- for a test echo server (only used by unit tests).</p>
- <p>These ports can be customized when creating a <a class="reference internal" href="py4j_java_gateway.html#py4j.java_gateway.JavaGateway" title="py4j.java_gateway.JavaGateway"><code class="xref py py-class docutils literal"><span class="pre">JavaGateway</span></code></a> on the Python side and a GatewayServer on the
- Java side.</p>
- </div>
- <div class="section" id="is-py4j-thread-safe">
- <h2><a class="toc-backref" href="#id10">6.8. Is Py4J thread-safe?</a><a class="headerlink" href="#is-py4j-thread-safe" title="Permalink to this headline">¶</a></h2>
- <p>The Java component of Py4J is thread-safe, but multiple threads could access
- the same entry point. Each gateway connection is executed in is own thread
- (e.g., each time a Python thread calls a Java method) so if multiple Python
- threads/processes/programs are connected to the same gateway, i.e., the same
- address and the same port, multiple threads may call the entry point’s methods
- concurrently.</p>
- <p>In the following example, two threads are accessing the same entry point. If
- <cite>gateway1</cite> and <cite>gateway2</cite> were created in separate processes, <cite>method1</cite> would
- be accessed concurrently.</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="c"># ... in Thread One</span>
- <span class="n">gateway1</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span> <span class="c"># Thread One is accessing the JVM.</span>
- <span class="n">gateway1</span><span class="o">.</span><span class="n">entry_point</span><span class="o">.</span><span class="n">method1</span><span class="p">()</span> <span class="c"># Thread One is calling method1</span>
- <span class="c"># ... in Thread Two</span>
- <span class="n">gateway2</span> <span class="o">=</span> <span class="n">JavaGateway</span><span class="p">()</span> <span class="c"># Thread Two is accessing the JVM.</span>
- <span class="n">gateway2</span><span class="o">.</span><span class="n">entry_point</span><span class="o">.</span><span class="n">method1</span><span class="p">()</span> <span class="c"># Thread Two is calling method1</span>
- </pre></div>
- </div>
- <p>The Python component of Py4J is also thread-safe, except the <a class="reference internal" href="py4j_java_gateway.html#py4j.java_gateway.GatewayClient.close" title="py4j.java_gateway.GatewayClient.close"><code class="xref py py-func docutils literal"><span class="pre">close</span></code></a> function of a
- <a class="reference internal" href="py4j_java_gateway.html#py4j.java_gateway.GatewayClient" title="py4j.java_gateway.GatewayClient"><code class="xref py py-class docutils literal"><span class="pre">CommChannelFactory</span></code></a>, which must
- not be accessed concurrently with other methods to ensure that all
- communication channels are closed. This is a trade-off to avoid accessing a
- lock every time a Java method is called on the Python side. This will only be a
- problem if attempting to shut down or close a JavaGateway while calling Java
- methods on the Python side.</p>
- <p>See <a class="reference internal" href="advanced_topics.html#adv-threading"><span>Py4J Threading Model</span></a> for more details.</p>
- </div>
- <div class="section" id="how-can-i-use-py4j-with-eclipse">
- <h2><a class="toc-backref" href="#id11">6.9. How can I use Py4J with Eclipse?</a><a class="headerlink" href="#how-can-i-use-py4j-with-eclipse" title="Permalink to this headline">¶</a></h2>
- <p>Because each Eclipse plug-in has its own class loader, a <cite>GatewayServer</cite>
- instance started in one plug-in won’t have access to the other plug-ins <strong>by
- default</strong>. You can work around this limitation by adding this line to the
- manifest of the plug-in where the GatewayServer resides:</p>
- <p><code class="docutils literal"><span class="pre">Eclipse-BuddyPolicy:global</span></code></p>
- <p>You can also use the Py4J Eclipse features that starts a default
- <cite>GatewayServer</cite> and that allows Python clients to refer to any classes declared
- in any plug-in.</p>
- <p>See <a class="reference internal" href="advanced_topics.html#eclipse-features"><span>Py4J and Eclipse</span></a> for more details.</p>
- </div>
- <div class="section" id="can-i-use-py4j-with-python-3">
- <h2><a class="toc-backref" href="#id12">6.10. Can I use Py4J with Python 3?</a><a class="headerlink" href="#can-i-use-py4j-with-python-3" title="Permalink to this headline">¶</a></h2>
- <p>Yes, thanks to a <a class="reference external" href="https://github.com/bartdag/py4j/commit/36a145671501ed47bc4002af7cab49b490eb6e0b">generous contributor</a>,
- Py4J now works with Python 3.</p>
- </div>
- <div class="section" id="are-there-any-security-concerns-with-py4j">
- <h2><a class="toc-backref" href="#id13">6.11. Are there any security concerns with Py4J?</a><a class="headerlink" href="#are-there-any-security-concerns-with-py4j" title="Permalink to this headline">¶</a></h2>
- <p>Running a Py4J gateway on a JVM exposes the JVM over the network, which is a
- major security concern because a client can use the JVM to run any code (access
- files, delete files, write programs and execute them, communicate over the
- network, etc.).</p>
- <p>By default, Py4J only listens to the IPv4 localhost (127.0.0.1), so if you
- trust all users having access to the localhost, the security risks are minimal
- because external programs and users do not have access to the localhost by
- default on most systems.</p>
- <p>If you use Py4J to make a JVM available over the network, you are responsible
- for ensuring that (1) only trusted sources can communicate with the JVM and
- (2) the privileges of the user running the JVM are properly constrained. This
- is usually achieved with a proper firewall configuration, network
- segmentation, and security policies configured with selinux or apparmor.</p>
- </div>
- <div class="section" id="i-found-a-bug-how-do-i-report-it">
- <h2><a class="toc-backref" href="#id14">6.12. I found a bug, how do I report it?</a><a class="headerlink" href="#i-found-a-bug-how-do-i-report-it" title="Permalink to this headline">¶</a></h2>
- <p>Please report bugs on our <a class="reference external" href="https://github.com/bartdag/py4j/issues">issue tracker</a>.</p>
- </div>
- <div class="section" id="how-can-i-contribute">
- <h2><a class="toc-backref" href="#id15">6.13. How can I contribute?</a><a class="headerlink" href="#how-can-i-contribute" title="Permalink to this headline">¶</a></h2>
- <p>There are many ways to contribute to Py4J:</p>
- <ul class="simple">
- <li><strong>Found a bug or have a feature request?</strong> Fill a detailed <a class="reference external" href="https://github.com/bartdag/py4j/issues">issue report</a>.</li>
- <li><strong>Found a typo or have a better way to clarify the documentation?</strong> Write a
- comment at the bottom of documentation the page, send a patch on the <a class="reference external" href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j/join">mailing
- list</a>,
- fill a <a class="reference external" href="https://github.com/bartdag/py4j/issues">bug report</a> or open a pull
- request. The source of each documentation page is accessible in the sidebar.
- We use <a class="reference external" href="http://docutils.sourceforge.net/docs/user/rst/quickstart.html">ReStructuredText</a></li>
- <li><strong>Good at writing Python or Java?</strong> Good news, we could use some help. You
- can open a pull request that adds a new feature or that address an <a class="reference external" href="https://github.com/bartdag/py4j/issues">open
- issue</a>. For new features, it is
- always best to discuss it on the <a class="reference external" href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j/join">mailing list</a> first.
- Do not forget to read our <a class="reference internal" href="contributing.html"><em>contribution guidelines</em></a>.</li>
- <li><strong>Feeling artistic?</strong> We need a logo. Hop on the <a class="reference external" href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j/join">mailing list</a>.</li>
- </ul>
- <p>In case of doubt, do not hesitate to contact the founder of the project,
- <a class="reference external" href="mailto:barthelemy%40infobart.com">Barthelemy</a>.</p>
- </div>
- </div>
- </div>
-
- <div class="helpbar">
- <h3>Questions/Feedback?</h3>
- <ul>
- <li>Try the <a href="faq.html">FAQ</a> -- It answers many questions.</li>
- <li>Search for information in the <a href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j">archives of the py4j-users mailing list</a>, or <a href="https://groups.google.com/a/py4j.org/forum/#!forum/py4j/join">post a question</a>.</li>
- <li>If you notice errors with this documentation, <a href="https://github.com/bartdag/py4j/issues">open a ticket</a> and let us know. Please, only open a ticket for feedback or improvements on the docs. To get help, use the links above!</li>
- </ul>
- </div>
-
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 5px">
- <a href="genindex.html" title="General Index"
- >index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="contributing.html" title="7. Contributing to Py4J"
- >next</a> |</li>
- <li class="right" >
- <a href="py4j_java.html" title="5. Py4J Java API"
- >previous</a> |</li>
- <li><a href="index.html">Home</a> |</li>
- <li><a href="download.html">Download</a> |</li>
- <li><a href="contents.html">Doc</a> |</li>
- <li><a href="https://blog.py4j.org">Blog</a> |</li>
- <li><a href="https://github.com/bartdag/py4j">github</a> |</li>
- <li><a href="about.html">About</a> »</li>
-
- </ul>
- </div>
- <div class="footer">
- © Copyright 2009-2013, Barthélémy Dagenais.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.1.
- </div>
- </div>
- </body>
- </html>
|