rr_python_utils
Module¶
Scripting Utilities for Royal Render’s Python Library¶
Provide functions and classes for caching RR modules, connect to the server, handling error results
Note
importing this package caches Royal Render libraries automatically, see rr_python_utils.cache.cache_module_locally()
Import Helpers¶
Different versions of Python require to import a different Royal Render library:
Python Version |
Royal Render Module |
Data Module |
Submission Module |
---|---|---|---|
2.7 |
libpyRR2 |
libpyRR2_datafiles |
libpyRR2_submit |
3.7 |
libpyRR37 |
libpyRR37_datafiles |
libpyRR37_submit |
3.9 |
|
||
3.10 |
|
|
|
3.11 |
|
|
|
Helper modules can make the import easier and ensure script compatibility between Python versions:
rr_python_utils.load_rrlib
¶
Imports Royal Render main module for the current version of Python,
e.g. libpyRR39
from rr_python_utils.load_rrlib import rrLib
rr_python_utils.load_rrdata
¶
Imports Royal Render data and statistics module for the current version of Python,
e.g. libpyRR39_datafiles
from rr_python_utils.load_rrdata import rrData
rr_python_utils.load_rrsubmit
¶
Imports Royal Render submission module for the current version of Python,
e.g. libpyRR39_submit
from rr_python_utils.load_rrsubmit import rrSubmitLib
Caching¶
- rr_python_utils.cache.cache_module_locally(module_folder=None, target_folder=None)¶
Copy files required for python script execution to a local temp folder, add temp folder to modules path.
Module files and their required dependenicy libs are locked while they are in use. If launched from the RR network folder, they might prevent updating Royal Render files. And there is a constant network connection. There have been cases in which a tiny network disruption caused Windows to fail loading additional functions from a dll
- rr_python_utils.cache.get_rr_bin_folder()¶
Return the path of Royal Render’s bin folder. Only works if RR was installed on the machine, as it relies on the env var RR_ROOT
- rr_python_utils.cache.rr_sync_copy(src_path, dst_path, errors)¶
Copies src_path to dst_path, skips copy if dst_path exists and is up to date
Connection¶
- rr_python_utils.connection.server_connect(user_name=None, password=None, askForlogin=False)¶
Return a rrServer
libpyRR39._rrTCP
connectionNote
Only works in your company: uses RR_ROOT enviroment variable.
A login is required if you have enabled Auth required for all connections in rrConfig tab rrLogin Or if you connect via a router (router has to be setup in rrConfig as well)
- Parameters:
user_name (str, optional) – Name of the user, defaults to None
password (str, optional) – user passowrd as set in rrConfig, defaults to None
askForlogin (bool, optional) – ask to input user_name and password if connection fails, defaults to False
Examples:
Anonymous
libpyRR39._rrTCP
connection to Royal Render serverimport rr_python_utils.connection as rr_connect tcp = rr_connect.server_connect()
Connect via
libpyRR39._rrTCP
with user name Mario. Ask to input a password if neededimport rr_python_utils.connection as rr_connect tcp = rr_connect.server_connect(user_name="Mario", askForlogin=True)
Connect via
libpyRR39._rrTCP
with user name Mario and password mammamia!import rr_python_utils.connection as rr_connect tcp = rr_connect.server_connect(user_name="Mario", password="mammamia!")
- rr_python_utils.connection.server_login(tcp, user_name=None, password=None)¶
Ask credentials for access to rrServer
Note
If you set a password, then the rrServer enables its authorization check. This means this user HAS TO to exist in RR.
If you are running this script from your local intranet, you probably do not need a password.
Please see rrHelp section Usage/External Connections/Security
Errors¶
- exception rr_python_utils.errors.RR_ConnectionError¶
- exception rr_python_utils.errors.RR_EnvironNotFound¶
- exception rr_python_utils.errors.RR_FolderNotFound¶
- exception rr_python_utils.errors.RR_GenericError¶
- exception rr_python_utils.errors.RR_IncompatibleVersion¶
- exception rr_python_utils.errors.RR_RecursiveCopyError¶