Altair® Panopticon

 

Python Integration

To enable Python connectivity:

1.     Download and install Python.

For ease of deployment we suggest the Anaconda Python distribution.

https://www.anaconda.com/distribution/

2.     Add Python installation folder to your Path environment variable.

 

    NOTE

On Windows, when using the Anaconda distribution of Python, you should add the following folder paths to your Windows System Environment variable Path:

·         \Anaconda3\

The folder where Python is installed.

·         \Anaconda3\Library\bin

The folder containing DLLs related to the installed Python packages.

 

 

3.     Download the latest version of Pyro4.

https://pypi.org/project/Pyro4/

For Windows, download the Wheel: Pyro4-4.79-py2.py3-none-any.whl

4.     Open the Anaconda Prompt. Navigate to the location of Pyro4-4.79-py2.py3-none-any.whl and run:

Pip install Pyro4-4.79-py2.py3-none-any.whl

Pyro is now installed into the Python site packages.

5.     Copy the start_Python_connectivity.bat, start_Python_connectivity.sh, and pyro.py files from  Panopticon Real Time Installation zip to a new location.

6.     Depending on your operation system:

·         Linux – run the start_Python_connectivity.sh file

·         Windows – run the start_Python_connectivity.bat file

Only step 6 needs to be repeated when Python connectivity is required.

 

    NOTE

To uninstall prior versions of Pyro:

pip uninstall Pyro4

 

 

The default password to secure connectivity is set to password.

To change this:

q  For Linux

Modify start_Python_connectivity.sh, editing the line:

python -m Pyro4.naming -n $1 -k "password"&

q  For Windows

Modify start_Python_connectivity.bat, editing the line:

start python -m Pyro4.naming -k "password"

Modify pyro.py, editing the line:

ns = Pyro4.locateNS(host=host, hmac_key="password")

Pyro is set to listen on a specific host/IP, which by default is localhost.

This can be modified through editing the batch file that instantiates Pyro.

@echo on

start python -m Pyro4.naming -n "[Required HostName]" -k "password"

ping localhost

cd "%~dp0"

python pyro.py "[Required HostName]"

pause

To enable the Pickle serialization, modify the configuration.py file located in ..\Anaconda3\Lib\site-packages\Pyro4 to specify the serialization to be used.

For example, if Pickle is selected, self.SERIALIZER value should be changed to pickle and self.SERIALIZERS_ACCEPTED value should be changed to include pickle:

def reset(self, useenvironment=True): """ Set default config items. If useenvironment is False, won't read environment variables settings (useful if you can't trust your env). """ self.HOST = "localhost" # don't expose us to the outside world by default self.NS_HOST = self.HOST self.NS_PORT = 9090 # tcp self.NS_BCPORT = 9091 # udp self.NS_BCHOST = None self.NATHOST = None self.NATPORT = 0 self.COMPRESSION = False self.SERVERTYPE = "thread" self.COMMTIMEOUT = 0.0 self.POLLTIMEOUT = 2.0 # seconds self.SOCK_REUSE = True # so_reuseaddr on server sockets? self.SOCK_NODELAY = False # tcp_nodelay on socket? self.THREADING2 = False # use threading2 if available? self.ONEWAY_THREADED = True # oneway calls run in their own thread self.DETAILED_TRACEBACK = False self.THREADPOOL_SIZE = 16 self.AUTOPROXY = True self.MAX_MESSAGE_SIZE = 0 # 0 = unlimited self.BROADCAST_ADDRS = "<broadcast>, 0.0.0.0" # comma separated list of broadcast addresses self.FLAME_ENABLED = False self.PREFER_IP_VERSION = 4 # 4, 6 or 0 (let OS choose according to RFC 3484) self.SERIALIZER = "pickle" self.SERIALIZERS_ACCEPTED = "pickle,marshal,json" # these are the 'safe' serializers self.LOGWIRE = False # log wire-level messages self.PICKLE_PROTOCOL_VERSION = pickle.HIGHEST_PROTOCOL self.METADATA = True # get metadata from server on proxy connect self.REQUIRE_EXPOSE = False # require @expose to make members remotely accessible (if False, everything is accessible) self.USE_MSG_WAITALL = hasattr(socket, "MSG_WAITALL") and platform.system() != "Windows" # not reliable on windows even though it is defined self.JSON_MODULE = "json" self.MAX_RETRIES = 0