What Python standard library functions are actually supported?

I’m playing around with Python and trying to do some stupid things.

From the V8 documentation Libraries page, it says:

Python has an extensive standard library that provides a host of new functionality to the scripting language. The python documentation goes over all of the libraries in its standard library as well as how to use them here: https://docs.python.org/2/library/index.html

OK, so far so good, so I create a simple Gateway startup script:

import sys
print "hello startup project:" , sys.version

Which generates a nice line in the wrapper log file:

hello startup project: 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43)

So now I try something slightly more adventurous:

import sys
import multiprocessing
print "hello startup project:" , sys.version

But this causes the startup script to crash and burn with an error message of:

ImportError: No module named multiprocessing

The Ignition docs pointed me to the Python 2.7 docs for the standard library functions. The Python docs tell me that multiprocessing is a valid library and was introduced in version 2.6. But the Gateway startup script rejects the import statement. Thus it seems that not all of the Python standard libraries are available to the (Gateway startup?) scripts. So is there any documentation that actually describes what is and is not available?

We don’t have a definitive list, but the Jython project might.

The multiprocessing module might have been a bit of bad luck. There’s an issue for it here in the Jython tracker: https://bugs.jython.org/issue2287

LOL so by a random chance I picked probably the one thing that didn’t work!

After reading various links it seems that the multiprocessing library will not be supported (but now at least I have learnt to google for the Jython version of things).

I also just saw Gateway Script to monitor directory for new files which has examples that seem to be using Java based concurrency, so I just need to change my approach

You can also drill down into your gateway install folder to see what is in the user-lib/pylib directory…

Thanks for that tip

Just to add a little to this discussion: The only two Python 2.7 standard libraries that I’ve come across that exist in CPython but not in Jython are multiprocessing and sqlite3.