Skip to content

Py4j Gateway issue when re-initializing pyboof #18

@gaurav-t-sca

Description

@gaurav-t-sca

Steps to replicate on version 0.40.1:

import pyboof as pb
import numpy as np
pyboof_detector = pb.FactoryFiducial(np.uint8).qrcode()  # Works

pb.init_pyboof()
pyboof_detector = pb.FactoryFiducial(np.uint8).qrcode()  # Throws an error

The error thrown is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/pyboof/recognition.py", line 533, in __init__
    self.boof_image_type = dtype_to_Class_SingleBand(dtype)
  File "/usr/local/lib/python3.9/site-packages/pyboof/image.py", line 512, in dtype_to_Class_SingleBand
    return gateway.jvm.java.lang.Class.forName(class_path)
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1709, in __getattr__
    answer = self._gateway_client.send_command(
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1036, in send_command
    connection = self._get_connection()
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 980, in _get_connection
    raise Py4JNetworkError("Gateway is not connected.")
py4j.protocol.Py4JNetworkError: Gateway is not connected

In the same interpreter, if I run pb.check_jvm(False) afterwards, it returns True

Versions:

  • Python 3.8.13
  • pyBoof 0.40.1
  • py4j 0.10.9.7
  • cat /etc/os-release -> Debian GNU/Linux 11 (bullseye)

Any help would be greatly appreciated. Thanks in advance!

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions