Using 3rd Party Python Library - PySerial

I am trying to read/write from a serial device using python’s pyserial library. I followed all the steps to install the package to jython mentioned in this post
Whenever I try to “import serial” in a the script console, I get the following error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\mdia\.ignition\cache\gwlocalhost_8088\C0\pylib\site-packages\serial\__init__.py", line 33, in <module>
    from serial.serialjava import Serial
  File "C:\Users\mdia\.ignition\cache\gwlocalhost_8088\C0\pylib\site-packages\serial\serialjava.py", line 38, in <module>
    comm = detect_java_comm([
  File "C:\Users\mdia\.ignition\cache\gwlocalhost_8088\C0\pylib\site-packages\serial\serialjava.py", line 32, in detect_java_comm
    raise ImportError("No Java Communications API implementation found")
ImportError: No Java Communications API implementation found

I now we did talk about this topic for a bit but a wanted to create a new post for it. Is there anyway to get around this error? I tried installing Java’s RxTx library and placed it in my java path folder by doing the following:

Copy rxtxParallel.dll to c:\Program Files\Java\jre1.8.0_271\bin
Copy rxtxSerial.dll to c:\Program Files\Java\jre1.8.0_271\bin
Copy RXTXcomm.jar to c:\Program Files\Java\jre1.8.0_271\lib\ext

However, I am still getting this error. Any ideas would be greatly appreciated.

Java Version 8 Update 271 (build 1.8.0_271-b09)
Ignition version 8.1.3

Ignition’s Serial Support modules use the well-maintained jSerialComm library under the hood. You should be using it, or the serial support modules themselves.

I don’t know if this is going to end up working for you at all, but if anything you would need to copy those to Ignition’s included Java runtime in $IGNITION/lib/runtime/jre-win and not that one.

Phil, sorry forgot to mention this, but I am trying to use another 3rd party python library that uses pyserial. When the scripts in that other module call for pyserial, I get this error. That’s why I am not using Ignition’s serial module, unless there’s a way to implement it with the 3rd party library that I am trying to use. How would I be able to use the jSerialComm library with my 3rd party python library? I found a jSerialComm executable Jar File online that downloads the following file jSerialComm-2.7.0.jar,
I also found a jSerialComm zip folder that downloaded the following files:
image

Do I need to copy these files anywhere in the Ignition directory?

Thanks in advance.

Kevin, I tried copying rxtxParallel.dll and rxtxSerial.dll in C:\Program Files\Inductive Automation\Ignition\lib\runtime\jre-win\bin

but wasn’t sure were to copy RXTXcomm.jar since that needs to be in the ext folder and $IGNITION/lib/runtime/jre-win/lib does not have that file. Any idea where I would need to copy that file to give this shot?

I think you might get away with putting them all into $IGNITION/lib/core/gateway.

You’ll have to restart the gateway and make sure you are running your test script in the gateway scope and not, e.g. the designer script console.