Using requests library

I’m trying to use the requests library to perform a simple request. I’ve followed the instructions and copied the library (including dependencies) to pylib/site-packages. However, I’m still getting the following error:

Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43)
[OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java11.0.4

ImportError: Cannot import site module and its dependencies: Error loading module XXXX: Traceback (most recent call last):
File “module:XXXX”, line 1, in
ImportError: No module named requests

Determine if the following attributes are correct:

  • sys.path: [C:\Users[…].ignition\cache\gwlocalhost_8088\C0\pylib, C:\Users[…].ignition\cache\resources\platform\jython-2.7.1-ia4.jar\000000006F6B69A0\Lib, classpath, pyclasspath/]
    This attribute might be including the wrong directories, such as from CPython
  • sys.prefix: C:\Users[…].ignition\cache\resources\platform\jython-2.7.1-ia4.jar\000000006F6B69A0
    This attribute is set by the system property python.home, although it can
    be often automatically determined by the location of the Jython jar file

You can use the -S option or python.import.site=false to not import the site module