robocorp / java-access-bridge-wrapper

Python wrapper around the Java Access Bridge Windows .dll
Apache License 2.0
14 stars 6 forks source link

jab_wrapper fails to initialise #1

Closed jsa34 closed 3 years ago

jsa34 commented 3 years ago

Using the following code (based on the example):

def get_jab_wrapper():
    start_test_application()
    pipe = queue.Queue()
    thread = threading.Thread(target=pump_background, daemon=True, args=[pipe])
    thread.start()
    jab_wrapper = pipe.get()
    if not jab_wrapper:
        raise Exception("Failed to initialize Java Access Bridge Wrapper")
    time.sleep(0.1)
    yield jab_wrapper
    logging.info("Shutting down JAB wrapper")
    if jab_wrapper:
        jab_wrapper.shutdown()

jab_wrapper / pipe.get() returns "None".

The application starts successfully, however. I have included the init code for the application here:

def start_test_application():
    jnlp_file: Path = Path(get_download_file())
    # Run the program in background
    logging.info("Opening JNLP application")
    subprocess.Popen(["javaws", get_download_file()], shell=True, close_fds=True)
    # Wait a bit for application to open
    time.sleep(20)

I have also made sure that:

Any advice much appreciated!

jsa34 commented 3 years ago

Apologies - resolved. I was suppressing some logging and saw the .dll needed to be referenced as an env var.

Now done and getting further