The Python Server¶
Initially the server script must be run by loading the
into your terminal to get the correct paths).
After that, these management commands are available in the Skill console.
- pyStartServer(id="default" logLevel="INFO" singleMode=nil timeout=nil python="python")¶
This starts the python server. If you are only running a single instance of Virtuoso you can use the default id. For more instances, each server needs its own id.
logLevelcan be used to set the log level, the default is
"INFO". Other values are
"DEBUG"to print absolutely everything,
The log levels
"INFO"are not recommended, because then the time for a round-trip between the client and the server is effectively two to three times as long!
singleModeparameter allows you to disable simultaneous connections to the server. By default, multiple connections are allowed for convenience reasons. Especially jupyter users will benefit from this, since jupyter keeps the socket connections open.
singleModeis disabled it is never safe to simultaneously access the server. This will lead to strange errors, where variables don’t contain what you initially assigned to them.
In order to stay safe: never interleave commands from two different connections.
timeoutparameter you can control how long the server will wait for the Skill code to finish.
nilmeans: wait forever, setting it to a number will wait at most that number as seconds.
Whenever a timeout occurs the python client and the Skill server are out of sync. You must restart the Skill server before you can continue.
The default python interpreter that is used to start the server is
"python". If your interpreter is called differently (e.g.
"python3.6") you can pass its name with the
pythonparameter. Your specified interpreter does not need the
skillbridgepackage. The only requirement is
The parameters are marked with
@keywhich means that it is only possible to change their default value by explicitly naming them when calling the function.
Here are a few examples:
; only change the log level to "INFO" pyStartServer ?logLevel "INFO" ; only change the server id to "foo" pyStartServer ?id "foo" ; change both server id and log level pyStartServer ?id "foo" ?logLevel "INFO" ; same as above, the order does not matter pyStartServer ?logLevel "INFO" ?id "foo" ; this tells the server to wait at most 10.5 seconds ; before sending a timeout error pyStartServer ?timeout 10.5 ; use a custom interpreter path pyStartServer ?python "python3.6"
This terminates the python subprocess and thus, kills the server. After that, no connections from the client side can be made anymore and active connections will result in a
BrokenPipeexception the next time they are used.
pyKillServer()and reloads the
python_server.ilSkill script. Normally this function would not be used.
Used for debugging. This shows the logging output from the python server. The parameter
numberOfLinescontrols how many lines will be printed. It always refers to the last
; show the last 10 lines of the log file pyShowLog ; show the last 20 lines of the log file pyShowLog 20