Communication between Python 2 and Python 3 by Redis

This explains the method of communication between Python 2 and Python 3 by Redis

Install Redis Server on Windows. Both Python 2 and Python 3 will act as Redis clients. This setup allows Python 2 and Python 3 to communicate with each other through the Redis Server. Note that the Redis Server does not necessarily have to be installed on Windows, as long as both Python 2 and Python 3 can connect to it.

Python 2: VC side
Python 3: Install Python 3.x, so you can use pip install to get the latest version of modules you want to use.

------ Files ------

  1. redis folder: This version is 2.10.6, very old, but works in VC, copy to C:\Users<User Name>\Documents\Visual Components\4.x\My Commands, for 4.9, copy to C:\Users<User Name>\Documents\Visual Components\4.x\My Commands\Python 2,
  2. Redis-x64-3.2.100.msi: Redis server on Windows
  3. RedisDemo.mp4: Demo video (Demo1: Python3 write joint values to Python2)
  4. RedisDemo.vcmx VC file
  5. RedisDemo.py: Python3 run this file
  6. RedisDemo_v2.mp4: Demo video (Demo2: Python2 call function from Python3)
  7. RedisDemo_v2.vcmx VC file
  8. RedisDemo_v2.py: Python3 run this file

------ Steps ------

  1. Install Redis-x64-3.2.100.msi (Also old version, but works)
  2. Open RedisDemo.vcmx in VC, start simulation (Demo1: Python3 write joint values to Python2)
  3. Execute RedisDemo.py in Python3
  4. Execute RedisDemo_v2.py in Python3 (Demo2: Python2 call function from Python3)
  5. Open RedisDemo_v2.vcmx in VC, start simulation

Redis_Python2_Python3.zip (16.2 MB)

4 Likes

If possible, can you upload a video? Unable to access YouTube, thank you very much

Sure

2 Likes