Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to install a Python module

#1
OK, I know this should be easy but I am having trouble with this and the search results are not helping.  A Python script (in the RoboDk station) needs to use a "non-standard" Python module.  I have installed the shared_memory_dict module using pip from a DOS window and it works fine in all Python scripts outside of RoboDK.

The SVG example in the documentation uses this code:
Code:
# locate and import the svgpy module
path_stationfile = RDK.getParam('PATH_OPENSTATION')
sys.path.append(os.path.abspath(path_stationfile))  # temporary add path to import station modules
from svgpy.svg import *

I have tried my version of this example code but it does not work
Code:
path_stationfile = self.RDK.getParam('PATH_OPENSTATION')
sys.path.append(os.path.abspath(path_stationfile))
from shared_memory_dict import SharedMemoryDict

Could you please recommend a better way to use other modules?  Is it possible to use pip to install the module directly into C:/RoboDK/Python-Embedded?

Thanks for your help.
#2
You should install the Python packages separately using pip install. For example, if you want to install the shared memory dictionary library on RoboDK's Python Embedded for Windows you can follow these steps:
  1. Select Tools-Run Script
  2. Select Install Python Package
  3. Enter shared-memory-dict (or the package you would like to install).
  4. Select OK and check for a success message being output in the status bar.
Another method is typing these commands in a MS-Dos window:
Code:
cd C:/RoboDK/Python-Embedded
python -m pip install shared-memory-dict
  




Users browsing this thread:
1 Guest(s)